lasso
This commit is contained in:
parent
c6bb97b942
commit
02d26d974f
@ -1,6 +1,6 @@
|
||||
import awkward as ak
|
||||
from sklearn.preprocessing import PolynomialFeatures
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn.linear_model import LinearRegression, Lasso
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.metrics import mean_squared_error
|
||||
import numpy as np
|
||||
@ -71,7 +71,7 @@ def fit_linear_regression_model(
|
||||
X_test_model = np.delete(X_test_model, remove, axis=1)
|
||||
poly_features = np.delete(poly_features, remove)
|
||||
|
||||
lin_reg = LinearRegression(fit_intercept=fit_intercept)
|
||||
lin_reg = LinearRegression(fit_intercept=fit_intercept) # Lasso(alpha=0.01)
|
||||
lin_reg.fit(X_train_model, y_train)
|
||||
y_pred_test = lin_reg.predict(X_test_model)
|
||||
print(f"Parameterisation for {target_feat}:")
|
||||
|
File diff suppressed because one or more lines are too long
@ -38,12 +38,10 @@
|
||||
"\n",
|
||||
"# selektiere nur elektronen von B->K*ee\n",
|
||||
"allcolumns = file.arrays()\n",
|
||||
"found = allcolumns[\n",
|
||||
" (allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromB)\n",
|
||||
"] # B: 9056\n",
|
||||
"lost = allcolumns[\n",
|
||||
" (allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromB)\n",
|
||||
"] # B: 1466\n",
|
||||
"found = allcolumns[(allcolumns.isElectron) & (~allcolumns.lost) &\n",
|
||||
" (allcolumns.fromB)] # B: 9056\n",
|
||||
"lost = allcolumns[(allcolumns.isElectron) & (allcolumns.lost) &\n",
|
||||
" (allcolumns.fromB)] # B: 1466\n",
|
||||
"\n",
|
||||
"electrons = allcolumns[(allcolumns.isElectron) & (allcolumns.fromB)]\n",
|
||||
"\n",
|
||||
@ -225,14 +223,16 @@
|
||||
" y = found[\"ideal_state_9410_y\"]\n",
|
||||
" qop = found[\"ideal_state_9410_qop\"]\n",
|
||||
"\n",
|
||||
"data = ak.zip({\n",
|
||||
" \"rad_length_frac\": rad_length_frac,\n",
|
||||
" \"x\": x,\n",
|
||||
" \"y\": y,\n",
|
||||
" \"tx\": slopex,\n",
|
||||
" \"ty\": slopey,\n",
|
||||
" \"qop\": qop,\n",
|
||||
"})\n",
|
||||
"data = ak.zip(\n",
|
||||
" {\n",
|
||||
" \"rad_length_frac\": rad_length_frac,\n",
|
||||
" \"x\": x,\n",
|
||||
" \"y\": y,\n",
|
||||
" \"tx\": slopex,\n",
|
||||
" \"ty\": slopey,\n",
|
||||
" \"qop\": qop,\n",
|
||||
" }\n",
|
||||
")\n",
|
||||
"lin_reg, features, xx0_test, xx0_predicted = fit_linear_regression_model(\n",
|
||||
" data,\n",
|
||||
" \"rad_length_frac\",\n",
|
||||
@ -357,16 +357,14 @@
|
||||
" y = lost[\"ideal_state_9410_y\"]\n",
|
||||
" qop = lost[\"ideal_state_9410_qop\"]\n",
|
||||
"\n",
|
||||
"data = ak.zip(\n",
|
||||
" {\n",
|
||||
" \"rad_length_frac\": rad_length_frac,\n",
|
||||
" \"x\": x,\n",
|
||||
" \"y\": y,\n",
|
||||
" \"tx\": slopex,\n",
|
||||
" \"ty\": slopey,\n",
|
||||
" \"qop\": qop,\n",
|
||||
" }\n",
|
||||
")\n",
|
||||
"data = ak.zip({\n",
|
||||
" \"rad_length_frac\": rad_length_frac,\n",
|
||||
" \"x\": x,\n",
|
||||
" \"y\": y,\n",
|
||||
" \"tx\": slopex,\n",
|
||||
" \"ty\": slopey,\n",
|
||||
" \"qop\": qop,\n",
|
||||
"})\n",
|
||||
"lin_reg, features, xx0_test, xx0_predicted = fit_linear_regression_model(\n",
|
||||
" data,\n",
|
||||
" \"rad_length_frac\",\n",
|
||||
|
Loading…
Reference in New Issue
Block a user