0% found this document useful (0 votes)
13 views3 pages

Sklearn Functions Summary

Sklearn functions

Uploaded by

Divy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Sklearn Functions Summary

Sklearn functions

Uploaded by

Divy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sklearn Functions Used in E3.

ipynb
Function Name Description
PolynomialFeatures Generates polynomial and interaction
features. Transforms the original feature
space to a higher degree polynomial space,
which allows linear models to learn non-
linear relationships.
Inputs: degree (int, degree of polynomial
features), interaction_only (bool, if True,
only interaction terms are produced),
include_bias (bool, if True, include a bias
column).
Outputs: Transformed features with
additional polynomial terms.
LinearRegression Implements ordinary least squares linear
regression. Fits a linear model to minimize
the residual sum of squares between the
observed and predicted values.
Inputs: fit_intercept (bool, whether to
calculate the intercept for this model),
normalize (bool, whether to normalize
input variables).
Outputs: Coefficients, intercept, and
predictions.
SVR A regression model using Support Vector
Machines (SVM). It tries to find a function
that deviates from the actual observed
targets by a value no greater than epsilon.
Uses different kernels (e.g., polynomial) to
handle non-linear data.
Inputs: kernel (str, kernel type such as
'linear', 'poly', 'rbf', etc.), C (float,
regularization parameter), epsilon (float,
margin of tolerance).
Outputs: Support vectors, coefficients, and
predictions.
RandomForestRegressor An ensemble method that fits multiple
decision trees on various sub-samples of
the dataset and averages them to improve
the predictive accuracy and control
overfitting.
Inputs: n_estimators (int, number of trees),
max_depth (int, maximum depth of trees),
min_samples_split (int, minimum number
of samples required to split an internal
node).
Outputs: Predictions, feature importances,
and estimators.
GradientBoostingRegressor An ensemble learning method that builds
models sequentially, where each model
attempts to correct the errors of its
predecessor. Often used for its high
accuracy in regression tasks.
Inputs: n_estimators (int, number of
boosting stages), learning_rate (float, step
size at each iteration), max_depth (int,
maximum depth of the individual
regression estimators).
Outputs: Predictions and feature
importances.
KNeighborsRegressor Implements k-nearest neighbors
regression. Predicts the target value for a
given input by averaging the values of its k
nearest neighbors.
Inputs: n_neighbors (int, number of
neighbors), weights (str or callable,
weighting function used in prediction),
algorithm (str, algorithm used to compute
the nearest neighbors).
Outputs: Predictions.
MLPRegressor A feedforward neural network regression
model that trains on backpropagation.
Suitable for modeling non-linear
relationships.
Inputs: hidden_layer_sizes (tuple, size of
the hidden layers), activation (str,
activation function for hidden layers),
solver (str, weight optimization solver),
max_iter (int, maximum number of
iterations).
Outputs: Predictions, loss values, and fitted
model parameters.
mean_squared_error Computes the mean squared error, which
measures the average of the squared
differences between predicted and actual
values. Useful for assessing the accuracy of
regression models.
Inputs: y_true (array, true values), y_pred
(array, predicted values), squared (bool, if
True returns MSE, if False returns RMSE).
Outputs: Mean squared error value.
r2_score Computes the R-squared score, which
represents the proportion of the variance
in the dependent variable that is
predictable from the independent
variables.
Inputs: y_true (array, true values), y_pred
(array, predicted values), sample_weight
(array, weights).
Outputs: R-squared score.

You might also like