
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
This code has two classes
def __init__(self,X:list,y:list,epoch:int,method='linear',theta=None,alpha=0.01,decimals=5) -> None:
# Usage
# Goal - to construct a linear regression for specified hyperparameters
gd = Descent(X=X_norm, y=y_norm, epoch=5000,alpha=0.01)
Constructs the Descent instance with the specified hyperparameters
Parameters:
def fit(self)->tuple:
# Goal - to calibrate the linear regression model
pastCost,pastTheta,stopEpoch = gd.fit()
Calibrates the coefficient for gradient descent
Returns:
def predict(self, values:list)->tuple:
# Goal - to predict the coefficients for the test set
bestTheta, preds = gd.predict(X_test)
Predicts the output for the specified values
Parameters
@property
def summary(self)->pd.DataFrame:
Prints the summary of the regression along with the necessary descriptive statistics
Returns the following metrics
If the model is linear, it also returns
If the model is logistic, it also returns
def __init__(self,data):
# Goal - to create a preprocess instance for x
X_scaler = Preprocess(X)
Stores the mean and standard deviation of the data for future transformations
def transform(self,values=None,add_ones=False)->np.array:
# Goal - to normalize the data and concatenate ones in the begining
X1 = X_scaler.transform(add_ones=True)
Normalizes the inputs by using the formula x_norm = (x-mean(x))/std(x)
Arguments:
def inverse_transform(self,inp):
#goal - to invert the transformation on the data
x_rescaled = X_scaler.inverse_transform()
Reverses the normalization by using the formula x = (x_norm*std(x))+mean(x)
Arguments
Returns the converted data
FAQs
Makes learning gradient descent easy
We found that GradientDescent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.