> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# Scikit-learn

> Scikit-learn: Machine learning in Python: classification, regression, clustering, dimensionality reduction and model selection.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/data_processing/scikit_learn/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/data_processing/scikit_learn/scikit_learn.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/data_processing/scikit_learn.ipynb)

Description:
- Machine learning in Python: classification, regression, clustering, dimensionality reduction and model selection.

Resources:
- [GitHub] https://github.com/scikit-learn/scikit-learn
- [Website] https://scikit-learn.org/stable/
- [Docs] https://scikit-learn.org/stable/user_guide.html
- [Examples] https://scikit-learn.org/stable/auto_examples/index.html

Source and license:
- Some of these examples are adapted from the scikit-learn documentation (Getting Started and the Naive Bayes user guide) (https://scikit-learn.org/stable/), Copyright (c) 2007-2026 The scikit-learn developers, licensed under BSD-3-Clause. That code stays under its own license; see [THIRD_PARTY_NOTICES.md](https://github.com/eugo-inc/ganymede/blob/main/THIRD_PARTY_NOTICES.md).

## Example 1

Fit a RandomForestClassifier to some very basic data

```python
from sklearn.ensemble import RandomForestClassifier

clf = RandomForestClassifier(random_state=0)
X = [[ 1,  2,  3],  # 2 samples, 3 features
     [11, 12, 13]]
y = [0, 1]  # classes of each sample
clf.fit(X, y)
```

## Example 2

Implements the Gaussian Naive Bayes algorithm for classification

```python
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB

X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)
gnb = GaussianNB()
y_pred = gnb.fit(X_train, y_train).predict(X_test)
print("Number of mislabeled points out of a total %d points : %d"
      % (X_test.shape[0], (y_test != y_pred).sum()))
```
