Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completed assignment of backslash (shree) #29

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions Shree/assignmentDL.ipynb

Large diffs are not rendered by default.

2,281 changes: 2,281 additions & 0 deletions Shree/kaggle_competition/EDA.ipynb

Large diffs are not rendered by default.

1,261 changes: 1,261 additions & 0 deletions Shree/kaggle_competition/submission.csv

Large diffs are not rendered by default.

125 changes: 125 additions & 0 deletions assMath/ass2B/shree/.ipynb_checkpoints/Q1A-checkpoint.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions assMath/ass2B/shree/.ipynb_checkpoints/Q1C-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
159 changes: 159 additions & 0 deletions assMath/ass2B/shree/.ipynb_checkpoints/Q2-checkpoint.ipynb

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions assMath/ass2B/shree/1B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 01:44:31 2023

@author: Shree
"""

import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import fsolve

np.random.seed(22)

def generate_data(n_dims, n_points, std):
global coefs
# equation will be of the form a1x1 + a2x2 + a3x3 ... = 0 forming a hyperplane
features = np.random.normal(0, std, (n_points, n_dims))
coefs = np.random.normal(0, std, (1, n_dims))
print(coefs.flatten())
# class will be decided based upon the distance and direction from the hyperplane
ys = (coefs @ features.T).flatten() + np.random.normal(0, 1, n_points)

return features, ys

n_dims = 10
n_points = 100
std = 5
features, ys = generate_data(n_dims, n_points, std)

plt.scatter(features[:, 0], ys)

# use scipy to solve system of equations
def equation_gen(coefficients):
#MLE estimate
return [np.sum((ys-coefficients[None, :]@features.T)*features[:, j]) for j in range(n_dims)]

def solve(equations):
solved_coefs = fsolve(equations, np.zeros(n_dims), )
return solved_coefs.flatten()

solved_coefs = solve(equation_gen)
print(solved_coefs)
plt.plot(features[:, 0], solved_coefs[0]*features[:, 0], c='red')
plt.plot(features[:, 0], coefs[0, 0]*features[:, 0], c='green')
125 changes: 125 additions & 0 deletions assMath/ass2B/shree/Q1A.ipynb

Large diffs are not rendered by default.

5,133 changes: 5,133 additions & 0 deletions assMath/ass2B/shree/Q1C.ipynb

Large diffs are not rendered by default.

159 changes: 159 additions & 0 deletions assMath/ass2B/shree/Q2.ipynb

Large diffs are not rendered by default.

Loading