Scikit Learn Python

This is the post dedicated to Scikit-Learn problems resolutions

Three steps involved in scikit-learn ML are as below:
Data Acquisition
Data Transformation
Data Cleaning

Question: What is Data Acquisition in Machine Learning, Data Science and Scikit-Learn?
Answer: The process of measuring physical world conditions and phenomena is called Data acquisition. The digital numeric values obtained can be manipulated by a compute for further analysis, storage and presentation.

Question: What is Data transformation in Machine Learning, Data Science and Scikit-Learn?
Answer: scikit-learn provides a library of transformers, which may clean, reduce, expand or generate feature representations.

Question: What is Data cleaning in Machine Learning, Data Science and Scikit-Learn?
Answer: Data cleaning is foundational element of data science. It is the process of fixing or removing incorrect, corrupted, incorrectly formatted, duplicate, or incomplete data within a dataset or combined multiple data sources.

Future Warning: The handling of integer data will change in version 0.22. Currently, the categories are determined based on the range [0, max(values)], while in the future they will be determined based on the unique values.
If you want the future behavior and silence this warning, you can specify “categories=’auto'”.

Traceback (most recent call last):
File “Affinity.py”, line 17, in
0.6988594508963273
print(metrics.homogeneity_score(aff.predict(X_test), Y_test))
File “…/python3.5/site-packages/sklearn/cluster/affinity_propagation_.py”, line 401, in predict
check_is_fitted(self, “cluster_centers_indices_”)
File “/…python3.5/site-packages/sklearn/utils/validation.py”, line 914, in check_is_fitted
raise NotFittedError(msg % {‘name’: type(estimator).name})
sklearn.exceptions.NotFittedError: This AffinityPropagation instance is not fitted yet. Call ‘fit’ with appropriate arguments before using this method.
Answer: to resolve this problem you need to first call the fit before invoking the predict method.
aff = AffinityPropagation(affinity = ‘euclidean’)
aff_classifier = aff.fit(X_train)
print(metrics.homogeneity_score( aff_classifier .predict(X_test), Y_test))


Leave a Comment

Your email address will not be published.