MCPcopy Index your code
hub / github.com/rushter/MLAlgorithms / regression

Function regression

examples/linear_models.py:17–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def regression():
18 # Generate a random regression problem
19 X, y = make_regression(
20 n_samples=10000,
21 n_features=100,
22 n_informative=75,
23 n_targets=1,
24 noise=0.05,
25 random_state=1111,
26 bias=0.5,
27 )
28 X_train, X_test, y_train, y_test = train_test_split(
29 X, y, test_size=0.25, random_state=1111
30 )
31
32 model = LinearRegression(lr=0.01, max_iters=2000, penalty="l2", C=0.03)
33 model.fit(X_train, y_train)
34 predictions = model.predict(X_test)
35 print("regression mse", mean_squared_error(y_test, predictions))
36
37
38def classification():

Callers 1

linear_models.pyFile · 0.70

Calls 4

LinearRegressionClass · 0.90
mean_squared_errorFunction · 0.90
fitMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected