Skip to content

Add reference to biclustering example in biclustering.rst documentation #31392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion benchmarks/bench_tsne_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

import numpy as np
from joblib import Memory
from sklearn.utils._openmp_helpers import _openmp_effective_n_threads

from sklearn.datasets import fetch_openml
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.neighbors import NearestNeighbors
from sklearn.utils import check_array
from sklearn.utils import shuffle as _shuffle
from sklearn.utils._openmp_helpers import _openmp_effective_n_threads

LOG_DIR = "mnist_tsne_output"
if not os.path.exists(LOG_DIR):
Expand Down
44 changes: 44 additions & 0 deletions examples/linear_model/plot_huber_regressor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Author: Soumya
"""
==============================================
Robust regression using HuberRegressor
==============================================

This example compares HuberRegressor and LinearRegression on a dataset
with strong outliers. HuberRegressor is more robust to outliers and
fits better on the inlier data.
"""

import matplotlib.pyplot as plt
import numpy as np

from sklearn.linear_model import HuberRegressor, LinearRegression
from sklearn.model_selection import train_test_split

# Generate random data
rng = np.random.RandomState(42)
X = 2 * rng.rand(100, 1) - 1
y = 3 * X.squeeze() + 0.5 * rng.randn(100)

# Add some strong outliers
X[:10] = 2 * rng.rand(10, 1) - 1
y[:10] += 10 * (0.5 - rng.rand(10)) # large noise

# Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)

# Fit both models
huber = HuberRegressor().fit(X_train, y_train)
ols = LinearRegression().fit(X_train, y_train)

# Plot results
plt.scatter(X_train, y_train, color="gray", alpha=0.6, label="Train data")
plt.plot(X_test, huber.predict(X_test), color="red", label="Huber Regressor")
plt.plot(
X_test, ols.predict(X_test), color="blue", linestyle="--", label="Linear Regression"
)
plt.legend()
plt.title("Comparison of Huber and Linear Regression")
plt.xlabel("X")
plt.ylabel("y")
plt.show(block=True)
Loading
Loading