| name | ml-fundamentals |
| description | Master machine learning foundations - algorithms, preprocessing, feature engineering, and evaluation |
| version | 1.4.0 |
| sasmp_version | 1.4.0 |
| bonded_agent | 01-ml-fundamentals |
| bond_type | PRIMARY_BOND |
| parameters | {"required":[{"name":"dataset","type":"dataframe","validation":"non-empty, numeric or categorical columns"}],"optional":[{"name":"target_column","type":"string","default":null},{"name":"test_size","type":"float","default":0.2,"validation":"0.1 <= x <= 0.4"}]} |
| retry_logic | {"strategy":"exponential_backoff","max_attempts":3,"base_delay_ms":1000} |
| logging | {"level":"info","metrics":["execution_time","memory_usage","data_shape"]} |
ML Fundamentals Skill
Master the building blocks of machine learning: from raw data to trained models.
Quick Start
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.ensemble import RandomForestClassifier
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
pipeline = Pipeline([
('scaler', StandardScaler()),
('classifier', RandomForestClassifier(random_state=42))
])
pipeline.fit(X_train, y_train)
score = pipeline.score(X_test, y_test)
print(f"Accuracy: {score:.4f}")
Key Topics
1. Data Preprocessing
| Step | Purpose | Implementation |
|---|
| Missing Values | Handle NaN/None | SimpleImputer(strategy='median') |
| Scaling | Normalize ranges | StandardScaler() or MinMaxScaler() |
| Encoding | Convert categories | OneHotEncoder() or LabelEncoder() |
| Outliers | Remove extremes | IQR method or Z-score |
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
sklearn.impute SimpleImputer
numeric_features = [, , ]
categorical_features = [, , ]
preprocessor = ColumnTransformer([
(, Pipeline([
(, SimpleImputer(strategy=)),
(, StandardScaler())
]), numeric_features),
(, Pipeline([
(, SimpleImputer(strategy=, fill_value=)),
(, OneHotEncoder(handle_unknown=))
]), categorical_features)
])