Skip to content

Commit

Permalink
fix examples 1
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdboom committed Aug 11, 2023
1 parent cce99f4 commit 90d4df7
Show file tree
Hide file tree
Showing 346 changed files with 872,153 additions and 3,916 deletions.
67 changes: 26 additions & 41 deletions atom/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def ATOMModel(
from sklearn.datasets import load_diabetes
from sklearn.linear_model import RANSACRegressor
ransac = ATOMModel(
estimator=RANSACRegressor(),
name="RANSAC",
needs_scaling=False,
)
ransac = ATOMModel(
estimator=RANSACRegressor(),
name="RANSAC",
needs_scaling=False,
)
X, y = load_diabetes(return_X_y=True, as_frame=True)
Expand Down Expand Up @@ -284,7 +284,7 @@ class ATOMClassifier(BaseTransformer, ATOM):
Examples
--------
```python
```pycon
from atom import ATOMClassifier
from sklearn.datasets import load_breast_cancer
Expand All @@ -295,18 +295,15 @@ class ATOMClassifier(BaseTransformer, ATOM):
# Apply data cleaning and feature engineering methods
atom.balance(strategy="smote")
atom.feature_selection(strategy="rfecv", solver="xgb", n_features=22)
atom.feature_selection(strategy="rfe", solver="lr", n_features=22)
# Train models
atom.run(
models=["LR", "RF", "XGB"],
metric="precision",
n_bootstrap=4,
)
atom.run(models=["LR", "RF", "XGB"])
# Analyze the results
atom.evaluate()
print(atom.results)
print(atom.evaluate())
```
"""
Expand Down Expand Up @@ -506,31 +503,22 @@ class ATOMForecaster(BaseTransformer, ATOM):
Examples
--------
```python
from atom import ATOMClassifier
from sklearn.datasets import load_breast_cancer
```pycon
from atom import ATOMForecaster
from sktime.datasets import load_airline
X, y = load_breast_cancer(return_X_y=True, as_frame=True)
y = load_airline()
# Initialize atom
atom = ATOMClassifier(X, y, n_jobs=2, verbose=2)
```
```python
# Apply data cleaning and feature engineering methods
atom.balance(strategy="smote")
atom.feature_selection(strategy="rfecv", solver="xgb", n_features=22)
atom = ATOMForecaster(y, verbose=2)
# Train models
atom.run(
models=["LR", "RF", "XGB"],
metric="precision",
n_bootstrap=4,
)
atom.run(models=["NF", "ES", "ETS"])
# Analyze the results
atom.evaluate()
print(atom.results)
print(atom.evaluate())
```
"""
Expand Down Expand Up @@ -737,29 +725,26 @@ class ATOMRegressor(BaseTransformer, ATOM):
Examples
--------
```python
```pycon
from atom import ATOMRegressor
from sklearn.datasets import load_diabetes
X, y = load_diabetes(return_X_y=True, as_frame=True)
# Initialize atom
atom = ATOMRegressor(X, y, n_jobs=2, verbose=2)
atom = ATOMRegressor(X, y, verbose=2)
# Apply data cleaning and feature engineering methods
atom.scale()
atom.feature_selection(strategy="rfecv", solver="xgb", n_features=12)
# Train models
atom.run(
models=["LR", "RF", "XGB"],
metric="precision",
n_bootstrap=4,
)
atom.run(models=["OLS", "RF", "XGB"])
# Analyze the results
atom.evaluate()
print(atom.results)
print(atom.evaluate())
```
"""
Expand Down
1 change: 1 addition & 0 deletions atom/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def _get_pred(
for attribute in ("decision_function", "predict_proba", "predict"):
if hasattr(self.estimator, attribute):
attr = attribute
break

y_true = getattr(self, f"y_{dataset}")
y_pred = getattr(self, f"{attr}_{dataset}")
Expand Down
11 changes: 0 additions & 11 deletions atom/data_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -2127,24 +2127,13 @@ class Normalizer(BaseEstimator, TransformerMixin, BaseTransformer):
atom.plot_distribution(columns=0)
```
:: insert:
url: /img/plots/plot_distribution_4.html
```python
atom.normalize(verbose=2)
print(atom.dataset)
atom.plot_distribution(columns=0)
```
:: insert:
url: /img/plots/plot_distribution_5.html
=== "stand-alone"
```python
from atom.data_cleaning import Normalizer
Expand Down
3 changes: 0 additions & 3 deletions atom/feature_engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,6 @@ class FeatureSelector(
atom.plot_pca()
```
:: insert:
url: /img/plots/plot_pca.html
=== "stand-alone"
```python
from atom.feature_engineering import FeatureSelector
Expand Down
Loading

0 comments on commit 90d4df7

Please sign in to comment.