JavaScript : How to Calculate the Check Digit according to ISO 6346

Learn how to calculate the check digit according to ISO 6346 for shipping containers. Prevent errors in tracking and documentation with this simple algorithm.… Read More JavaScript : How to Calculate the Check Digit according to ISO 6346

How to Reference List of Dicitionaries from One Class to Another?

I am currently working on an inventory system and trying to implement a class that serves as a "fast fact finer" for my database, which is managed by my Database Management class. The csv file looks like this: I have the following code: class DataBase_Management(object): def __init__(self): self.result = [] def make_dict_items(self): with open("Items2.csv") as… Read More How to Reference List of Dicitionaries from One Class to Another?

Linear regression (Gradient descent) single feature

import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model class gradientdescent: def fit(self,X,Y): lr=0.01 m=5 b=0 m_gradient=0 for _ in range(1000): m_gradient= (lr*(np.sum((m*X+b-Y)*X))/(np.size(X))) b_gradient= (lr*(np.sum(m*X+b-Y))/(np.size(X))) self.m=m-m_gradient #this part is giving me conflicting results self.b=b-b_gradient #and this part def predict(self,X): return self.m*X+self.b X=np.array([1,2,3,4,5,6,7,8]) Y=np.array([1,2,4,4,5,7,8,8]) clf=gradientdescent() clf.fit(X,Y) plt.scatter(X,Y, color=’black’) plt.plot(X, clf.predict(X)) #np.size(X) I have… Read More Linear regression (Gradient descent) single feature