Forum

Notifications
Clear all

SUP-3: Classification  

   RSS

0

Hi can, anyone help me, I am unable to proceed with the following codes....

Model Building

 

In [*]:
 
 
 
 
 
In [*]:
 
 
 
 
 
In [*]:
 
 
 
 
 
In [*]:
 
 
 
 
In [*]:
 
 
 
 
 
 

Evaluation

For regression problems, we are familiar with common metrics such as Root Means Square Error (RMSE) and the Coefficient of Determination (R2value).

With classification problems, we need a different set of metrics to evaluate the model. Here, we use metrics such as:

  • Confusion Matrix
  • Precision
  • Recall
  • F1 score
  • ROC and AUC

Read the following blog posts to get familiar with these terms:

Once you are done, proceed to the next cells.

In [132]:
 
 
 
 
---------------------------------------------------------------------------
NotFittedError                            Traceback (most recent call last)
 in 
      1 # Apply the model on the test data
----> 2pred_test = model.predict(x_test)

D:\Python\lib\site-packages\sklearn\utils\metaestimators.py in (*args, **kwargs)
    114 
    115         # lambda, but not partial, allows help() to work with update_wrapper
--> 116out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs)
    117         # update the docstring of the returned function
    118         update_wrapper(out, self.fn)

D:\Python\lib\site-packages\sklearn\pipeline.py in predict(self, X, **predict_params)
    417         Xt = X
    418         for _, name, transform in self._iter(with_final=False):
--> 419Xt = transform.transform(Xt)
    420         return self.steps[-1][-1].predict(Xt, **predict_params)
    421 

D:\Python\lib\site-packages\sklearn\compose\_column_transformer.py in transform(self, X)
    557 
    558         """
--> 559check_is_fitted(self)
    560         X = _check_X(X)
    561         if hasattr(X, "columns"):

D:\Python\lib\site-packages\sklearn\utils\validation.py in check_is_fitted(estimator, attributes, msg, all_or_any)
    965 
    966     if not attrs:
--> 967raise NotFittedError(msg % {'name': type(estimator).__name__})
    968 
    969 

NotFittedError: This ColumnTransformer instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
Share:

Delete your account