Train Scikit-Learn model

Train Scikit-Learn model on provided data (X, y). The X should be DataFrame or NumPy array with input data matrix. The y is a target attribute, with values that will be learn by model. User can specify sample weight, which describes how important is each sample, in the advanced options. This method can train any model that implements Scikit-Learn API.


Required packages

You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.


Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

In the below recipe, we assume that you have following variables available in your notebook:

  • my_classifier (type DecisionTreeClassifier)
  • my_regressor (type DecisionTreeRegressor)
  • X (type DataFrame)
  • y (type Series)

Python code

# Python code will be here

Code explanation

This code fits model on training data (X, y). The training time depends on data size (number or rows and columns) and algorithm complexity.

Example Python notebooks

Please find inspiration in example notebooks