crandas.crlearn
The crandas.crlearn module provides the following functionality:
Machine learning models:
General:
Model interface
CModel = Model
module-attribute
Deprecated
Use of this alias is deprecated
Alias for Model
Model(**params_and_query_args)
Base class for machine learning models stored at the server
The API for crandas machine learning models is similar to that of
scikit-learn estimators. Functions such as .fit() and .set_params
are applied in-place to the Model. Internally, the Model
has a field instance that refers to a
StateObject at
the server and that is updated when such functions are applied.
Similarly to scikit-learn, models have parameters (set by the user) and
attributes (set based on fitting the model on data). Typically, at least
some of the attributes are encrypted (e.g., fitted model parameters). The
encrypted attributes can be retrieved by opening the model using
open().
Models typically have a .fit() function to fit the model, and functions
.predict(), .predict_proba(), .transform() to apply the fitted model.
When using the model, it is typically required to use the same feature names
as used during fitting. If the dataset has different column names or a different
column order, the columns need to be adjusted, e.g.:
# Columns during fit: "a", "b"
cdf = cd.DataFrame({"a": [1], "b": [2]}, auto_bounds=True)
mms = cd.crlearn.utils.MinMaxScaler().fit(cdf)
# Wrong column order can be fixed using indexing
cdf2 = cd.DataFrame({"b": [2], "a": [1]}, auto_bounds=True)
mms.transform(cdf2[mms.feature_names_in_])
# Wrong column names can be fixed using .rename or .set_axis
# this assumes that the columns are already in the correct order
cdf3 = cd.DataFrame({"a": [2], "B": [1]}, auto_bounds=True)
mms.transform(cdf3.rename({"B": "b"}))
mms.transform(cdf3.set_axis(mms.feature_names_in_, axis=1))
attributes
property
Retrieve attributes for the estimator.
Only available for fitted estimators. Encrypted attributes are set to
None. To retrieve their values, use open().
handle
property
Return the handle of the current instance of the model
instance = crandas.command.vdl_query(query, instance, **query_args)
class-attribute
instance-attribute
Current model instance (updated by .fit(), .set_params(), etc)
params
property
Retrieve parameters for the estimator.
Note that the parameters can be set using .set_params().
from_opened(params_attributes, **query_args)
classmethod
Upload model to the server
Should be called on an instance of the final model class, e.g., LinearRegression.
| PARAMETER | DESCRIPTION |
|---|---|
params_attributes
|
Parameters and attributes as returned by
TYPE:
|
open()
Download the model
The model is returned as a dictionary of parameters and attributes.
save(name=None, **query_args)
Save the (current instance of the) model. Returns the saved object, i.e., self.
See StateObject.save().
set_params(**params_and_query_args)
Set parameters of the estimator
| PARAMETER | DESCRIPTION |
|---|---|
params_and_query_args
|
Model parameters (see documentation for specific model) or query arguments (see Query Arguments)
TYPE:
|
Model selection
train_test_split(*arrays, test_size=None, train_size=None, random_state=None, shuffle=True)
Split arrays or matrices into random train and test subsets.
This function has been implemented as to match the scikit-learn variant as well as possible.
| PARAMETER | DESCRIPTION |
|---|---|
arrays
|
sequence of dataframes with same length
TYPE:
|
test_size
|
If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the test split. If int, represents the absolute number of test samples. If None, the value is set to the complement of the train size. If train_size is also None, it will be set to 0.25.
TYPE:
|
train_size
|
If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the train split. If int, represents the absolute number of train samples. If None, the value is automatically set to the complement of the test size.
TYPE:
|
random_state
|
Controls the shuffling applied to the data before applying the split. Pass an int for reproducible output across multiple function calls.
TYPE:
|
shuffle
|
Whether or not to shuffle the data before splitting
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list
|
train+test dataframe for each specified input |
Metrics
classification_accuracy(y, y_pred, n_classes=2, **query_args)
Compute the classification accuracy on class predictions
| PARAMETER | DESCRIPTION |
|---|---|
y
|
column with the actual values in range
TYPE:
|
y_pred
|
column with the predictions in range
TYPE:
|
n_classes
|
number of classes
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between 0 and 1 |
confusion_matrix(y, y_pred, n_classes=2, **query_args)
Compute the confusion matrix on class predictions
The y-axis of the result represents the true class. The x-axis the predicted class.
| PARAMETER | DESCRIPTION |
|---|---|
y
|
column with the actual values in range
TYPE:
|
y_pred
|
column with the predictions in range
TYPE:
|
n_classes
|
number of classes
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
matrix of size n_classes * n_classes |
mcfadden_r2(model, X, y, **query_args)
Compute the McFadden \(R^2\) metric
| PARAMETER | DESCRIPTION |
|---|---|
model
|
logistic regression model
TYPE:
|
X
|
predictor variables
TYPE:
|
y
|
binary response variable (should have only 1 column)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between 0 and 1 |
model_deviance(model, X, y, **query_args)
Compute the model deviance
| PARAMETER | DESCRIPTION |
|---|---|
model
|
logistic regression model
TYPE:
|
X
|
predictor variables
TYPE:
|
y
|
binary response variable (should have only 1 column)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between 0 and 1 |
null_deviance(y, **query_args)
Compute the null deviance
Attention
Both classes NEED to be present in y, otherwise the computations are undefined internally (logarithm of 0)
| PARAMETER | DESCRIPTION |
|---|---|
y
|
binary response variable (should have only 1 column)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between 0 and 1 |
precision_recall(y, y_pred, **query_args)
Compute the precision and recall on predictions
| PARAMETER | DESCRIPTION |
|---|---|
y
|
column with the actual values (binary)
TYPE:
|
y_pred
|
column with the predictions (binary)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
two fixed numbers between 0 and 1 |
score_r2(y, y_pred, **query_args)
Compute the \(R^2\) metric on predictions
| PARAMETER | DESCRIPTION |
|---|---|
y
|
column with the actual values
TYPE:
|
y_pred
|
column with the predictions
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between < 1 |
tjur_r2(y, y_pred, **query_args)
Compute the Tjur \(R^2\) metric on predictions
| PARAMETER | DESCRIPTION |
|---|---|
y
|
column with the actual values (binary)
TYPE:
|
y_pred
|
column with the predictions (probabilities!)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
fixed point number between -1 and 1 |
Utility functions
CMinMaxScaler = MinMaxScaler
module-attribute
Deprecated
Use of this alias is deprecated
Alias for MinMaxScaler
MinMaxScaler(feature_range=(0, 1), *, copy=True, clip=False, **query_args)
Bases: Model
MinMaxScaler transform
Transform features by scaling each feature to the interval [0,1], similarly to scikit-learn's
MinMaxScaler.
The constructor parameters are provided for compatibility with scikit-learn and must not be modified.
For example:
from crandas.crlearn.utils import MinMaxScaler
cdf = cd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, auto_bounds=True)
scaler = MinMaxScaler()
# Fit scaler such that colums of `cdf` are scaled to [0,1]
scaler.fit(cdf)
# Alternatively, use fit_transform to get scaled dataset
cdf_scaled = scaler.fit_transform(cdf)
>>> print(cdf_scaled.open())
a b
0 0.0 0.0
1 0.5 0.5
2 1.0 1.0
# Scale `cdf2` according to scaling determined from `cdf`
cdf2 = cd.DataFrame({"a": [2, 4], "b": [5, 9]}, auto_bounds=True)
cdf2_scaled = scaler.transform(cdf2)
>>> print(cdf2_scaled.open())
a b
0 0.5 0.5
1 1.5 2.5
Attributes of fitted models
n_features_in: number of input featuresfeature_names_in: input feature namesmin: (encrypted) per-feature adjustment for minimumscale: (encrypted) per-feature relative scaling
fit(X, y=None, *, features='all', **query_args)
Compute the minimum and maximum to be used for later scaling
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Training data
TYPE:
|
y
|
Ignored
TYPE:
|
features
|
Feature (column) names to normalize
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MinMaxScaler
|
Fitted model |
fit_transform(X, y=None, *, features='all', **query_args)
Fit to data, then transform it
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Training data
TYPE:
|
y
|
Ignored
TYPE:
|
features
|
Feature (column) names to normalize
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Normalized data. All columns (also non-normalized ones) are converted to fixed point. |
transform(X, **query_args)
Scale features of X according to computed scaling
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Data to normalize
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Normalized data. All columns (also non-normalized ones) are converted to fixed point. |
min_max_normalize(table, columns=None, **query_args)
Apply min-max normalization on columns of a table, to get values in [0, 1]
Deprecated
Use MinMaxScaler instead.
| PARAMETER | DESCRIPTION |
|---|---|
table
|
table to normalize
TYPE:
|
columns
|
columns that should be normalized. If None, all columns will be normalized. The columns that are not specified in this list will remain untouched, by default None
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
new table with normalized columns |
Linear regression
CLinearRegression = LinearRegression
module-attribute
Deprecated
Use of this alias is deprecated
Alias for LinearRegression
LinearRegression(alpha=0.0, *, fit_intercept=True, copy_X=True, n_jobs=None, positive=False, **query_args)
Bases: Model
Linear ridge regression classifier corresponding to the scikit-learn
Ridge.
Parameters:
alpha: regularization strength (see scikit-learn documentation); defaults to0.0
Other constructor parameters are for compatibility with scikit-learn and cannot be overridden.
Attributes:
n_features_in_: number of input featuresfeature_names_in_: input feature namesbeta_: (encrypted) fitted parameters (intercept and respective feature coefficients)standard_error_: (encrypted) standard-error of each fitted parametersingular_: boolean representing if singularity of the model is detected
fit(X, y, **query_args)
Fit a Linear Regression model on the data
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Training data
TYPE:
|
y
|
Target data (should have only 1 column)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
|
get_beta(**query_args)
Get the fitted parameters (i.e. intercept and feature coefficients) as a table
Deprecated
This function is deprecated; instead, use Model.open()
to open the model and use the returned beta_ attribute.
predict(X, **query_args)
Make predictions on a dataset using a linear regression model
Note
This function returns predictions on the target, not probabilities!
| PARAMETER | DESCRIPTION |
|---|---|
X
|
predictor variables
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
table containing the column consisting of the predicted target values |
score(X, y, **query_args)
Scores the linear regression model using the \(R^2\) metric
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Test data
TYPE:
|
y
|
Target test data (should have only 1 column)
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
|
Ridge(alpha=1.0, *, fit_intercept=True, copy_X=True, max_iter=None, tol=None, solver='cholesky', positive=False, random_state=None, **params_and_query_args)
Create a new ridge regression model (LinearRegression) with given alpha (1.0 by default)
Other parameters are for compatibility with scikit-learn and cannot be overridden.
Logistic regression
CLogisticRegression = LogisticRegression
module-attribute
Deprecated
Use of this alias is deprecated
Alias for LogisticRegression
LogisticRegression(penalty='l2', *, optimizer='lbfgs', type='binomial', dual=False, tol=0.0001, C=1.0, fit_intercept=True, intercept_scaling=1, class_weight=None, random_state=None, solver=None, max_iter=10, verbose=0, warm_start=False, n_jobs=None, l1_ratio=None, **query_args)
Bases: Model
Logistic Regression Classifier Object with the same parameters as the Scikit-learn
LogisticRegression
class.
Constructor parameters not shown here have the same meaning as in scikit-learn but cannot be changed from their defaults.
| PARAMETER | DESCRIPTION |
|---|---|
type
|
(
TYPE:
|
optimizer
|
optimizer used to fit the model (see
TYPE:
|
max_iter
|
number of iterations to perform
TYPE:
|
warm_start
|
whether to continue fitting from the previous optimizer state
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
feature_names_in_ |
input feature names
|
n_classes_ |
number of output classes
TYPE:
|
feature_name_out_ |
output feature name
|
optimizer_ |
attributes of the optimizer used to fit the model (see crandas.crlearn.optimizer.OptimizerAttributes)
|
beta_ |
(encrypted) fitted parameters (intercept(s) and coefficients)
|
fit(X, y, *, n_classes=None, sample_weight=None, **query_args)
Fit a LogisticRegression model on the data
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Training data
TYPE:
|
y
|
Target data (should have only 1 column)
TYPE:
|
n_classes
|
Number of output classes (categories). For binomial models, if not given, n_classes is
assumed to be equal to two. For other models, if not given, the number of classes is
derived from the metadata of
DEFAULT:
|
sample_weight
|
Not supported
DEFAULT:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
TYPE:
|
from_beta(beta, *, type='binomial', n_classes=2, feature_names_in, feature_name_out='out')
Upload pre-fittted logistic regression model
| PARAMETER | DESCRIPTION |
|---|---|
beta
|
Fitted parameters
TYPE:
|
type
|
Type of model ("binomial"/"multinomial"/"ordinal")
TYPE:
|
n_classes
|
Number of classes
TYPE:
|
feature_names_in
|
Input feature names
|
feature_name_out
|
Output feature name
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
LogisticRegression
|
Logistic regression model with given parameters |
predict(X, decision_boundary=0.5, **query_args)
Make (binary) predictions on a dataset using a logistic regression model
Note
This function returns binary predictions, not probabilities!
| PARAMETER | DESCRIPTION |
|---|---|
X
|
predictor variables
TYPE:
|
decision_boundary
|
number between 0 and 1; records with a probability below this value are classified as 0, greater than or equal to as 1
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
table containing the column consisting of the predicted target values |
predict_proba(X, **query_args)
Make (probability) predictions on a dataset using a logistic regression model
Note
This function returns probabilities, not binary predictions
| PARAMETER | DESCRIPTION |
|---|---|
X
|
predictor variables
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
table with columns representing predicted class probabilities per input record |
Random forest classifier
CRandomForestClassifier = RandomForestClassifier
module-attribute
Deprecated
Use of this alias is deprecated
Alias for RandomForestClassifier
RandomForestClassifier(n_estimators=10, *, max_depth=4, bootstrap=True, max_features='sqrt', max_samples=0.3, criterion='gini', random_state=None, warm_start=False, class_weight=None, ccp_alpha=0.0, monitonic_cst=0, **query_args)
Bases: Model
Random forest classifier with an interface similar to skikit-learn's
RandomForestClassifier.
Features can be ordinal (node \(val \leq T\)) or categorical (node \(val = T\)), as specified when
fitting. Output labels are categorical values \(0, 1, \dots, M\), where the number $ is derived from
the column metadata, e.g., use labels.astype({"labels": "int[min=0,max=2]"}) to set \(M=2\).
Configurable parameters:
n_estimators: number of trees (integer; default: 10)max_depth: depth (number of layers of internal nodes) per tree (integer; default: 4)bootstrap: whether to use bootstrapping, i.e., training respective trees on respective samples (drawn with replacement) from the input data (boolean; default: True)max_features: number of features to consider per split (integer number/float fraction/ "sqrt"/"log2"/"all"; default: "sqrt")max_samples: number of samples per tree if bootstrapping is used (integer number/float fraction; default: 0.3)
The constructor parameters criterion, random_state, warm_start, class_weight,
ccp_alpha, monotonic_cst have the same meaning as in sklearn but cannot be changed from
their defaults.
Other sklearn parameters are not applicable to the present implementation. Specifically: options
min_samples_split, min_samples_leaf, min_weight_fraction_leaf, max_leaf_nodes,
min_impurity_decrease are not applicable since the current implementation trains all trees
up to their maximum depth max_depth. Generalization scores are not provided, so
oob_score is not supported. Also parameters n_jobs and verbose for controlling the
fitting process are not available.
Attributes of fitted models
n_features_in: number of input featuresfeature_names_in: input feature namesfeature_types_in: column types of input feature columnsn_classes: number of classesfeature_name_out: name of output featuredepths: depths of respective treesnodes_featureids: (encrypted) one-hot encoded features selected per internal nodenodes_values: (encrypted) threshold values per internal nodenodes_modes: (encrypted) mode per internal node: discrete or continuousclass_weights: (encrypted) class probabilities per leaf node
Implementation notes
The implemented random forest classifier uses the same training technique as sklearn, except
that trees are always trained up to their maximum depth max_depth (for this reason, options
min_samples_split, min_samples_leaf, min_weight_fraction_leaf, max_leaf_nodes,
min_impurity_decrease are not applicable).
fit(X, y, *, n_classes=None, categorical_features=None, max_categories=None, **query_args)
Build a forest of trees from the training set
The dataset X can contain any mix of ordinal features (nodes \(val \leq T\)) and categorical
features (nodes \(val = T\)). Features are considered ordinal unless specified in the list
of categorical features. Fitting of categorical features is considerably more efficient
but costs more memory, so the number of different categories is limited by the server.
This limit can be overridden using the max_categories parameter.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Training data
TYPE:
|
y
|
Target data (should have only 1 column)
TYPE:
|
n_classes
|
Number of output classes (categories). If None, the number of classes is derived from
the metadata of
DEFAULT:
|
categorical_features
|
Column names of columns that are considered to contain categorical features
TYPE:
|
max_categories
|
If given, override the engine's maximum number of categories per categorical feature
DEFAULT:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
|
open_to_graphs(**query_args)
predict(X, **query_args)
Predict class for X
| PARAMETER | DESCRIPTION |
|---|---|
X
|
predictor variables
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
table with predicted class per input record |
predict_proba(X, **query_args)
Predict class probabilities for X
| PARAMETER | DESCRIPTION |
|---|---|
X
|
predictor variables
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
table with columns representing predicted class probabilities per input record |
k-nearest neighbours regressor
KNeighborsRegressor(n_neighbors=5, *, weights='uniform', algorithm='auto', p=2, metric='minkowski', metric_weights=None)
Regression based on k-nearest neighbors with similar use as the scikit-learn K-Nearest Regressor Class.
The target is predicted by local interpolation of the targets associated of the nearest neighbors in the training set.
Warning
In the k-Nearest Neighbors algorithms, if two neighbors,
neighbor k+1 and k, have identical distances but
different labels, the results will depend on the ordering of
the training data.
| PARAMETER | DESCRIPTION |
|---|---|
n_neighbors
|
Number of neighbors to use.
TYPE:
|
p
|
Power parameter for the Minkowski metric. When p = 1, this is equivalent to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used. Currently, integer values between 1 and 5 are supported.
TYPE:
|
metric_weights
|
Weights given to the different columns for the metric. The differences
between columns are multiplied by the corresponding factors given in
TYPE:
|
fit(X, y)
Fit the k-nearest neighbors classifier from the training dataset.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Predictor variables.
TYPE:
|
y
|
Response variable (should have only 1 column).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
TYPE:
|
predict_value(X, **query_args)
Predict the target value for the provided data.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Predictor variables. Required to contain a single row.
TYPE:
|
query_args
|
See Query Arguments
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
Predicted value.
TYPE:
|
Optimizer settings
Settings of optimizers used e.g. in logistic regression models. Whenever a value for a parameter is not given, the engine uses a default value if one is available.
OptimizerAttributes = Annotated[Union[AdamOptimizerAttributes, AdamaxOptimizerAttributes, GradientDescentOptimizerAttributes, LbfgsOptimizerAttributes], Field(discriminator='optimizerattributes_type')]
module-attribute
Optimizer attributes
StepsizeScheduleAttributes = Annotated[Union[LineSearchStepsizeAttributes, CurvatureAdaptiveStepsizeAttributes, ConstantStepsizeAttributes, AdamDecayingStepsizeAttributes], Field(discriminator='stepsizeattributes_type')]
module-attribute
Stepsize attributes
StepsizeScheduleParams = Annotated[Union[LineSearchStepsizeParams, CurvatureAdaptiveStepsizeParams, ConstantStepsizeParams, AdamDecayingStepsizeParams], Field(discriminator='stepsizeparams_type')]
module-attribute
Stepsize parameters
AdamDecayingStepsizeAttributes
Bases: ModelWithMasking
Adam decaying stepsize attributes
alpha
instance-attribute
Decaying stepsize attribute
iteration
instance-attribute
Current iteration
AdamDecayingStepsizeParams
Bases: BaseModel
Adam decaying stepsize parameters
alpha = None
class-attribute
instance-attribute
Decaying step size parameter
AdamOptimizerAttributes
Bases: ModelWithMasking
Adam optimizer attributes
beta1
instance-attribute
beta1 attribute
beta2
instance-attribute
beta2 attribute
m
instance-attribute
Internal state variable m
stepsize_schedule
instance-attribute
Stepsize attributes
v
instance-attribute
Internal state variable v
vhat
instance-attribute
Internal state variable vhat
AdamOptimizerParams
Bases: BaseModel
Adam optimizer parameters
amsgrad = None
class-attribute
instance-attribute
Whether to use AMSGrad
beta1 = None
class-attribute
instance-attribute
beta1 parameter
beta2 = None
class-attribute
instance-attribute
beta2 parameter
epsilon = None
class-attribute
instance-attribute
epsilon parameter
stepsize_schedule = None
class-attribute
instance-attribute
Stepsize to use
AdamaxOptimizerAttributes
Bases: ModelWithMasking
Adamax optimizer attributes
beta1
instance-attribute
beta1 attribute
beta2
instance-attribute
beta2 attribute
m
instance-attribute
Internal state m
stepsize_schedule
instance-attribute
Stepsize attributes
u
instance-attribute
Internal state u
AdamaxOptimizerParams
Bases: BaseModel
Adamax optimizer parameters
beta1 = None
class-attribute
instance-attribute
beta1 parameter
beta2 = None
class-attribute
instance-attribute
beta2 parameter
epsilon = None
class-attribute
instance-attribute
epsilon parameter
stepsize_schedule = None
class-attribute
instance-attribute
Stepsize parameters
ConstantStepsizeAttributes
Bases: ModelWithMasking
Constant stepsize attributes
alpha
instance-attribute
Step size attribute
iteration
instance-attribute
Current iteration
ConstantStepsizeParams
Bases: BaseModel
Constant stepsize parameters
alpha = None
class-attribute
instance-attribute
Step size parameter
CurvatureAdaptiveStepsizeAttributes
Bases: BaseModel
Curvature adaptive stepsize attributes
iteration
instance-attribute
Current iteration
CurvatureAdaptiveStepsizeParams
Bases: BaseModel
Curvature adaptive stepsize parameters
GradientDescentOptimizerAttributes
Bases: ModelWithMasking
Gradient descent optimizer attributes
momentum
instance-attribute
Momentum attribute
stepsize_schedule
instance-attribute
Stepsize attributes
v
instance-attribute
Internal state v
GradientDescentOptimizerParams
Bases: BaseModel
Gradient descent optimizer parameters
momentum = None
class-attribute
instance-attribute
Momentum parameter
stepsize_schedule = None
class-attribute
instance-attribute
Stepsize parameters
LbfgsOptimizerAttributes
Bases: ModelWithMasking
LBFGS optimizer attributes
last_gradient
instance-attribute
Internal state last_gradient
rho
instance-attribute
Internal state rho
s
instance-attribute
Internal state s
stepsize_schedule
instance-attribute
Stepsize attributes
y
instance-attribute
Internal state y
LbfgsOptimizerParams
Bases: BaseModel
LBFGS optimizer parameters
history = None
class-attribute
instance-attribute
History
stepsize_schedule = None
class-attribute
instance-attribute
Stepsize schedule
LineSearchStepsizeAttributes
Bases: BaseModel
Line search step size attributes
iteration
instance-attribute
Current iteration
LineSearchStepsizeParams
Bases: BaseModel
Line search step size parameters
end = None
class-attribute
instance-attribute
End parameter
start = None
class-attribute
instance-attribute
Start parameter
OptimizerParams
Bases: RootModel
Optimizer parameters
Optimizer parameters can be specified as a name of a supported optimizer
(adam, adamax, gd, or lbfgs) or as an instance of an optimizer parameter
type, e.g., crandas.crlearn.optimizer.AdamaxOptimizerParams.