# Install required packages
!pip install --upgrade pip
!pip install -q -r requirements.txt

```
Requirement already satisfied: pip in /root/venv/lib/python3.7/site-packages (21.0.1)
```

# sklearn modules
import sklearn
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_squared_error
from sklearn.pipeline import make_pipeline
from sklearn.compose import ColumnTransformer, make_column_transformer
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV, KFold
from sklearn.linear_model import Ridge
from sklearn.linear_model import RidgeCV
from sklearn.linear_model import Lasso
# pandas, numpy, and plotting
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as st
from scipy.stats import norm
# schrutepy
from schrutepy import schrutepy
np.random.seed(44)

# Display plots inline
%matplotlib inline
# Plotting defaults
plt.rcParams['figure.figsize'] = (8,5)
plt.rcParams['figure.dpi'] = 80
df = schrutepy.load_schrute()

#Combining number of reviews and average review rating, deleting previous columns
d = pd.read_csv("the_office.csv")
tv = d["total_votes"].mean()
d["Episode Scor"] = 0.7*d["imdb_rating"] + 10*(0.3)*(1-np.exp((d["total_votes"])/np.log(1/2)*tv))
d['Episode Score'] = d['Episode Scor'].apply(lambda x: round(x, 2))
del d['total_votes']
del d['imdb_rating']
del d['Episode Scor']

plt.hist(d['Episode Score'],bins=10,alpha=0.7,color = 'green', density = True)
plt.xlabel('Episode Score')
plt.ylabel('Frequency Density')
plt.title('Histogram of Episode Scores')
score_fit = norm.fit(d['Episode Score'])
x_vals = np.linspace(7.4,10.4,1000)
pdf = norm.pdf(x_vals,score_fit[0],score_fit[1])
plt.plot(x_vals,pdf)

nam = list(d["episode_name"])
cam_1 = ["Hot Girl","Office Olympics","The Fire","The Client","E-Mail Surveilance","Valentine's Day","The Convention","The Return","Launch Party (Parts 1&2)","Business Trip","New Boss","Two Weeks","Dream Team","The Michael Scott Paper Company","Stairmageddon","Promos","Livin' the Dream","Heavy Competition","Broke","Sabre","Mafia","The Delivery (Parts 1&2)","Nepotism","The Sting","The Seminar","Training Day","Michael's Last Dundies","Goodbye, Michael","The Inner Circle","Mrs. California","Turf War","Here Comes Treble","The Boat","Lice","Paper Airplane"]
cam_2 = ["Booze Cruise","Garden Party"]
cam_3 = ["Stress Relief (Parts 1&2)"]
cam_4 = ["Finale"]
cam_5 = ["Search Committee (Parts 1&2)"]
cameos = [0] * 186
for i in cam_1:
cameos[nam.index(i)] = 1
for i in cam_2:
cameos[nam.index(i)] = 2
for i in cam_3:
cameos[nam.index(i)] = 3
for i in cam_4:
cameos[nam.index(i)] = 4
for i in cam_5:
cameos[nam.index(i)] = 5
d["Number of Cameos"] = cameos

d["Episode Length (Minutes)"] = (23,23,22,23,23,23,21,22,22,22,30,22,22,22,23,22,22,22,22,22,22,22,22,21,22,22,22,22,
23,22,22,22,22,22,31,30,30,42,21,22,28,21,21,22,21,30,21,21,29,28,42,42,42,42,42,22,30,30,30,30,30,22,30,42,42,43,22,
22,30,22,22,30,30,22,30,30,22,60,60,60,22,30,30,30,30,21,22,30,22,30,30,30,30,30,30,49,30,30,30,23,30,30,30,30,30,30,
60,30,23,30,30,30,30,30,30,30,30,30,30,30,30,23,30,30,30,60,30,30,30,22,30,30,30,30,20,50,23,23,42,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,22,22,22,22,22,22,42,22,22,22,22,42,
43,51,)
d["Episode Location (Binary)"] = (0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,0,0,0,
1,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,1,
0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,0,0,1,
0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1)

#finding best director
unique_directors = d['director'].unique().tolist()
directors = list(d["director"])
director_count = []
for i in unique_directors:
dir_count = 0
for j in d.director:
if j == i:
dir_count += 1
director_count.append(dir_count)
count = 0
names = []
for i in range(0,len(unique_directors)):
if director_count[i] >5:
names.append(unique_directors[i])
count+=1
for i in directors:
if i not in names:
directors[directors.index(i)] = "others"
directors1 = pd.get_dummies(directors)
directors1.columns = ['D: Charles McDougall', 'D: David Rogers','D: Greg Daniels','D: Jeffrey Blitz','D: Ken Kwapis',
'D: Ken Whittingham' , 'D: Matt Sohn','D: Paul Feig','D: Paul Lieberstein','D: Randall Einhorn','D: Others']

writers = list(d.writer)
for j in writers:
if j == 'Lee Eisenberg;Gene Stupnitsky':
writers[writers.index(j)] = "Gene Stupnitsky;Lee Eisenberg"

#finding best writers
unique_writers = d['writer'].unique().tolist()
writer_count = []
for i in unique_writers:
wri_count = 0
for j in d.writer:
if j == i:
wri_count += 1
writer_count.append(wri_count)
count = 0
names = []
for i in range(0,len(unique_writers)):
if writer_count[i] >6:
names.append(unique_writers[i])
count+=1
for i in writers:
if i not in names:
writers[writers.index(i)] = "others"
writers1 = pd.get_dummies(writers)
writers1.columns = ['W: B.J. Novak', 'W:Brent Forrester','W:Charlie Grandy','W:Gene Stupnitsky;Lee Eisenberg',
'W:Greg Daniels', 'W:Jennifer Celotta' , 'W:Justin Spitzer','W:Michael Schur','W:Mindy Kaling','W:Paul Lieberstein',
'W: Others']

d = pd.concat([d, writers1], axis=1)
d = pd.concat([d, directors1], axis=1)

# Lineshare (number of lines spoken by characters)
# Remove records that don't contain dialogue
df = df.dropna()
df
episode_names = d.episode_name
# Main 39 characters
main_chars = ["Michael","Dwight","Jim","Pam","Andy","Angela","Kevin","Erin","Oscar","Ryan"]
n_main_chars = len(main_chars) # Number of main characters
n_episodes = len(episode_names) # Number of episodes
array = np.zeros((n_episodes,n_main_chars)) # Create array of zeros with episode number as rows and character names as columns
# Create array of number of lines spoken by each characters
for i in episode_names:
for j in main_chars:
episode_names_list = episode_names.values.tolist()
row = episode_names_list.index(i)
col = main_chars.index(j)
episode = df.loc[df['episode_name'] == i]
character_lines = episode.loc[episode['character'] == j]
number_lines = len(character_lines)
array[row,col] = number_lines
# Create array with proportion of lines spoken by each character

array_proportion = np.zeros((186,10))
for i in range(0,186):
row_tot = sum(array[i,:])
for j in range(0,10):
array_proportion[i,j] = array[i,j]/row_tot
# To produce models using these variables without skewing the dependency on variables, we reduce the number of characters we consider
ten_main_prop = array_proportion
# To show that all columns are indepent, we show ten_main_prop has full rank
print("The rank of ten_main_prop is:",np.linalg.matrix_rank(ten_main_prop))
# Add characters to dataframe
for i in range(0,10):
d[main_chars[i]] = ten_main_prop[:,i]

```
The rank of ten_main_prop is: 10
```

pd.DataFrame(new_d)

n_linesint64131 – 625 | n_directionsint6411 – 166 | n_wordsint641098 – 6076 | n_speak_charint6412 – 54 | Episode Scorefloat647.69 – 9.79 | Number of Cameosint640 – 5 | Episode Length (Minutes)int6420 – 60 | Episode Location (Binary)int640 – 1 | W: B.J. Novakuint80 – 1 | W:Brent Forresteruint80 – 1 | W:Charlie Grandyuint80 – 1 | W:Gene Stupnitsky;Lee Eisenberguint80 – 1 | W:Greg Danielsuint80 – 1 | W:Jennifer Celottauint80 – 1 | W:Justin Spitzeruint80 – 1 | W:Michael Schuruint80 – 1 | W:Mindy Kalinguint80 – 1 | W:Paul Liebersteinuint80 – 1 | W: Othersuint80 – 1 | D: Charles McDougalluint80 – 1 | D: David Rogersuint80 – 1 | D: Greg Danielsuint80 – 1 | D: Jeffrey Blitzuint80 – 1 | D: Ken Kwapisuint80 – 1 | D: Ken Whittinghamuint80 – 1 | D: Matt Sohnuint80 – 1 | D: Paul Feiguint80 – 1 | D: Paul Liebersteinuint80 – 1 | D: Randall Einhornuint80 – 1 | D: Othersuint80 – 1 | Michaelfloat640 – 0.707 | Dwightfloat640.027 – 0.538 | Jimfloat640 – 0.354 | Pamfloat640 – 0.341 | Andyfloat640 – 0.404 | Angelafloat640 – 0.261 | Kevinfloat640 – 0.132 | Erinfloat640 – 0.27 | Oscarfloat640 – 0.149 | Ryanfloat640 – 0.234 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

0 | 229 | 27 | 2757 | 15 | 8.32 | 0 | 23 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.40703517587939697 | 0.1457286432160804 | 0.18090452261306533 | 0.20100502512562815 | 0 | 0.005025125628140704 | 0.005025125628140704 | 0 | 0.01507537688442211 | 0.04020100502512563 | |

1 | 203 | 20 | 2808 | 12 | 8.81 | 0 | 23 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.47770700636942676 | 0.10828025477707007 | 0.15286624203821655 | 0.07643312101910828 | 0 | 0.025477707006369428 | 0.050955414012738856 | 0 | 0.08280254777070063 | 0.025477707006369428 | |

2 | 244 | 21 | 2769 | 13 | 8.53 | 0 | 22 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0.26291079812206575 | 0.29107981220657275 | 0.19718309859154928 | 0.15023474178403756 | 0 | 0.023474178403755867 | 0.028169014084507043 | 0 | 0.04225352112676056 | 0.004694835680751174 | |

3 | 243 | 24 | 2939 | 14 | 8.67 | 0 | 23 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3177570093457944 | 0.21962616822429906 | 0.22897196261682243 | 0.102803738317757 | 0 | 0.03271028037383177 | 0.014018691588785047 | 0 | 0.06542056074766354 | 0.018691588785046728 | |

4 | 230 | 49 | 2437 | 18 | 8.88 | 0 | 23 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5842696629213483 | 0.1404494382022472 | 0.11797752808988764 | 0.07865168539325842 | 0 | 0.016853932584269662 | 0.0056179775280898875 | 0 | 0.011235955056179775 | 0.0449438202247191 | |

Expand rows 5 - 180 | |||||||||||||||||||||||||||||||||||||||||

181 | 273 | 59 | 2965 | 24 | 8.6 | 1 | 22 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0.4264705882352941 | 0.11029411764705882 | 0.0661764705882353 | 0.22058823529411764 | 0.014705882352941176 | 0.03676470588235294 | 0.07352941176470588 | 0.051470588235294115 | 0 | |

182 | 234 | 48 | 2564 | 27 | 8.6 | 1 | 22 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0.14685314685314685 | 0.11888111888111888 | 0.15384615384615385 | 0.2727272727272727 | 0.11188811188811189 | 0.06993006993006994 | 0.11188811188811189 | 0.013986013986013986 | 0 | |

183 | 382 | 33 | 4333 | 20 | 9.23 | 1 | 42 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1888111888111888 | 0.2202797202797203 | 0.1048951048951049 | 0.23776223776223776 | 0.1048951048951049 | 0.045454545454545456 | 0.03146853146853147 | 0.06643356643356643 | 0 | |

184 | 501 | 54 | 4965 | 30 | 9.51 | 0 | 43 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.23324396782841822 | 0.2386058981233244 | 0.09115281501340483 | 0.11796246648793565 | 0.10455764075067024 | 0.08042895442359249 | 0.058981233243967826 | 0.07506702412868632 | 0 | |

185 | 522 | 107 | 5960 | 54 | 9.79 | 4 | 51 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006153846153846154 | 0.23384615384615384 | 0.2246153846153846 | 0.13846153846153847 | 0.09538461538461539 | 0.07076923076923076 | 0.09538461538461539 | 0.033846153846153845 | 0.055384615384615386 | 0.046153846153846156 | |

186 rows × 40 columns |

pd.DataFrame(new_d)
new_d = d.drop(columns=['season','episode','director','writer','air_date','main_chars','episode_name'])

new_d_main_vars = new_d[['n_lines','n_directions','n_words','n_speak_char','Episode Score','Number of Cameos','Episode Length (Minutes)']]
plt.figure(figsize=(12, 8))
mask = np.triu(np.ones_like(new_d_main_vars.corr(), dtype=np.bool))
corr = new_d_main_vars.corr()
kot = corr[abs(corr)>=0.5]
ax = plt.axes()
sns.heatmap(kot, mask=mask, vmin=-1, vmax=1, annot=True,ax=ax)
ax.set_title("Correlation Heatmap between Main Variables", fontsize = 16)
plt.show()

new_d_characters = new_d[["Michael","Dwight","Jim","Pam","Andy","Angela","Kevin","Erin","Oscar","Ryan"]]
plt.figure(figsize=(12,8))
mask = np.triu(np.ones_like(new_d_characters.corr(),dtype=np.bool))
corr1 = new_d_characters.corr()
kot1 = corr1[abs(corr1)>=0.35]
ax = plt.axes()
sns.heatmap(kot1, mask=mask, vmin=-1, vmax=1, annot=True, ax = ax)
ax.set_title("Heatmap of correlation between main characters", fontsize = 16)
plt.show()

new_d = new_d.drop(columns=["n_lines","n_words","Dwight","Oscar","Erin","Andy","Kevin"])

# List of non binary and none dropped after heat map correlation test features.
non_binary_column_names = ['n_directions','n_speak_char','Number of Cameos','Episode Length (Minutes)',
'Michael','Jim','Pam','Angela','Ryan']

fig, axes = plt.subplots(3,3, figsize=(12, 12), sharey=True)
degree_range = 5
colours = ['red','green','black','magenta','cyan']
for i in range(3):
for j in range(3):
x = new_d[non_binary_column_names[3*i+j]]
y = new_d['Episode Score']
sns.scatterplot(ax=axes[i,j],x = new_d[non_binary_column_names[3*i+j]],y = new_d['Episode Score'])
for r in range(1,degree_range):
degree = r
X = pd.DataFrame(x)
X_seq = np.linspace(X.min(),X.max(),186).reshape(-1,1)
polyreg=make_pipeline(PolynomialFeatures(degree),LinearRegression())
polyreg.fit(X,y)
axes[i,j].plot(X_seq,polyreg.predict(X_seq),color=colours[r-1], label = 'Degree =' + str(r))
if j == 0:
if i == 0:
axes[i,j].legend()

new_d = new_d.drop(columns=["Jim","Ryan","Pam","Angela"])

#helper functions
def get_coefs(m):
"""Returns the model coefficients from a Scikit-learn model object as an array,
includes the intercept if available.
"""
# If pipeline, use the last step as the model
if (isinstance(m, sklearn.pipeline.Pipeline)):
m = m.steps[-1][1]
if m.intercept_ is None:
return m.coef_
return np.concatenate([[m.intercept_], m.coef_])
def model_fit(m, X, y, title, plot = False):
"""Returns the root mean squared error of a fitted model based on provided X and y values.
Args:
m: sklearn model object
X: model matrix to use for prediction
y: outcome vector to use to calculating rmse and residuals
plot: boolean value, should fit plots be shown
"""
y_hat = m.predict(X)
rmse = mean_squared_error(y, y_hat, squared=False)
res = pd.DataFrame(
data = {'y': y, 'y_hat': y_hat, 'resid': y - y_hat}
)
if plot:
plt.figure(figsize=(12, 6))
plt.subplot(121)
sns.lineplot(x='y', y='y_hat', color="grey", data = pd.DataFrame(data={'y': [min(y),max(y)], 'y_hat': [min(y),max(y)]}))
sns.scatterplot(x='y', y='y_hat', data=res).set_title("Fit plot")
plt.subplot(122)
sns.scatterplot(x='y', y='resid', data=res).set_title("Residual plot")
plt.subplots_adjust(left=0.0)
plt.suptitle(title + str(round(rmse, 4)), fontsize=16)
plt.show()
return rmse

kf = KFold(n_splits = 5, shuffle = True,random_state=1)
result = next(kf.split(new_d), None)
train = new_d.iloc[result[0]]
test = new_d.iloc[result[1]]
x_train = train.drop(columns=['Episode Score'])
y_train = train['Episode Score']

# Non scaled
lm = LinearRegression(fit_intercept = False).fit(x_train, y_train)
#From now on we will only fit to x_train with scaled categorical features
scaled_features = x_train
col_names = ['n_directions', 'n_speak_char', 'Michael', 'Number of Cameos','Episode Length (Minutes)']
features = scaled_features[col_names]
scaler = StandardScaler().fit(features.values)
features = scaler.transform(features.values)
scaled_features[col_names] = features
x_train_scaled = scaled_features
lm_scaled = make_pipeline(
LinearRegression(fit_intercept=False)
).fit(x_train_scaled, y_train)

```
n_directions n_speak_char Number of Cameos Episode Length (Minutes) \
0 -0.925480 -1.133235 -0.386708 -0.542896
1 -1.200838 -1.723794 -0.386708 -0.542896
2 -1.161501 -1.526941 -0.386708 -0.667661
3 -1.043491 -1.330088 -0.386708 -0.542896
5 -0.453437 -1.526941 1.080798 -0.542896
.. ... ... ... ...
179 0.411974 0.835295 -0.386708 -0.667661
182 -0.099405 1.229002 1.080798 -0.667661
183 -0.689459 -0.148970 1.080798 1.827637
184 0.136616 1.819561 -0.386708 1.952402
185 2.221471 6.544035 5.483316 2.950521
Episode Location (Binary) W: B.J. Novak W:Brent Forrester \
0 0 0 0
1 0 1 0
2 0 0 0
3 0 0 0
5 0 0 0
.. ... ... ...
179 0 0 0
182 0 0 0
183 0 0 0
184 0 0 1
185 1 0 0
W:Charlie Grandy W:Gene Stupnitsky;Lee Eisenberg W:Greg Daniels ... \
0 0 0 0 ...
1 0 0 0 ...
2 0 0 0 ...
3 0 0 0 ...
5 0 0 0 ...
.. ... ... ... ...
179 0 0 0 ...
182 0 0 0 ...
183 0 0 0 ...
184 0 0 0 ...
185 0 0 1 ...
D: Greg Daniels D: Jeffrey Blitz D: Ken Kwapis D: Ken Whittingham \
0 0 0 1 0
1 0 0 1 0
2 0 0 0 1
3 0 0 0 0
5 0 0 0 0
.. ... ... ... ...
179 0 0 0 0
182 0 0 0 0
183 0 1 0 0
184 0 0 0 0
185 0 0 1 0
D: Matt Sohn D: Paul Feig D: Paul Lieberstein D: Randall Einhorn \
0 0 0 0 0
1 0 0 0 0
2 0 0 0 0
3 0 0 0 0
5 0 0 0 0
.. ... ... ... ...
179 0 0 1 0
182 0 0 0 0
183 0 0 0 0
184 0 0 0 0
185 0 0 0 0
D: Others Michael
0 0 0.793108
1 0 1.177739
2 0 0.008712
3 1 0.307212
5 1 0.876245
.. ... ...
179 0 -1.422179
182 1 -1.422179
183 0 -1.422179
184 0 -1.422179
185 0 -1.388687
[148 rows x 28 columns]
```

# Tuning linear ridge model for best alpha
alphas = np.linspace(0.0000001, 0.01, num=200)
lm_scaled_ridge = GridSearchCV(
make_pipeline(
Ridge(fit_intercept = False)
),
param_grid={'ridge__alpha': alphas},
cv=KFold(5, shuffle=True),
scoring="neg_root_mean_squared_error"
).fit(x_train_scaled, y_train)

get_coefs(lm_scaled_ridge.best_estimator_)[1:30]

alphas = np.linspace(0.0000001, 1, num=100)
lm_scaled_lasso = GridSearchCV(
make_pipeline(
Lasso(fit_intercept = False)
),
param_grid={'lasso__alpha': alphas},
cv=KFold(5, shuffle=True),
scoring="neg_root_mean_squared_error"
).fit(x_train_scaled, y_train)

```
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 2.3591709171598034, tolerance: 0.9079128
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.4249080906339548, tolerance: 0.9087204599999997
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 2.0365933509693672, tolerance: 0.91500415
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 2.3353808576754496, tolerance: 0.9149997499999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 2.398513687184385, tolerance: 0.9187737999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 2.962527837288174, tolerance: 1.1413527399999999
positive)
```

get_coefs(lm_scaled_lasso.best_estimator_)[1:30]

poly_model = make_pipeline(
make_column_transformer(
(PolynomialFeatures(include_bias=False), ['n_directions']),
(PolynomialFeatures(include_bias=False), ['n_speak_char']),
(PolynomialFeatures(include_bias=False), ['Number of Cameos']),
remainder='passthrough'),
LinearRegression(fit_intercept=False))
parameters_poly_model = {
'columntransformer__polynomialfeatures-1__degree': np.arange(1,4,1),
'columntransformer__polynomialfeatures-2__degree': np.arange(1,3,1),
'columntransformer__polynomialfeatures-3__degree': np.arange(1,4,1),
}
kf = KFold(n_splits=5, shuffle=True, random_state=0)
grid_search_poly_model = GridSearchCV(poly_model,
parameters_poly_model,
cv=kf,
scoring="neg_root_mean_squared_error").fit(x_train_scaled, y_train)

get_coefs(grid_search_poly_model.best_estimator_)[1:30]

alphas_poly = np.linspace(0.014, 0.015, num=10)
poly_model_lasso = make_pipeline(
make_column_transformer(
(PolynomialFeatures(include_bias=False), ['n_directions']),
(PolynomialFeatures(include_bias=False), ['n_speak_char']),
(PolynomialFeatures(include_bias=False), ['Number of Cameos']),
remainder = 'passthrough'),
Lasso(fit_intercept = False))
parameters_poly_model_lasso = {
'columntransformer__polynomialfeatures-1__degree': np.arange(1,4,1),
'columntransformer__polynomialfeatures-2__degree': np.arange(1,3,1),
'columntransformer__polynomialfeatures-3__degree': np.arange(1,4,1),
'lasso__alpha': alphas_poly,
}
grid_search_poly_model_lasso = GridSearchCV(poly_model_lasso,
parameters_poly_model_lasso,
cv=kf,
scoring="neg_root_mean_squared_error",
).fit(x_train_scaled, y_train)

```
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.18447672181334, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.229899348911843, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.275247649262244, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.320521652735529, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.365720164539908, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.410840303665502, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.45588623946302, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.500857998348572, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.5457556059210305, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.590579087111358, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.08017760944732, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.027043611299185, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.318100556524524, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.303880266224496, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.543272352864356, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.580254472103505, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.767793088763906, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.856190559521366, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.99166685516753, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.13159318484269, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.214894728877226, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.4062873774912, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.437527048426013, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.68057813358187, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.659493982195478, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.95441730452494, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.880642084711376, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 42.22785393309127, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 29.100977972093645, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 42.50085601293259, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.27766285287634, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9429321851603163, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8562832776652556, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.353140703179456, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9505409255508397, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8697761980603218, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.428461990412643, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9581338801953194, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8832435866206083, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.503635367673198, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9657103619959031, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8966862494558825, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.578655232298466, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9732678039472518, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.910104228430928, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.653521520359462, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9807931317925274, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.9234862236484993, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.728287346675458, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9883057172810545, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.93684326552496, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.802920771013852, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.9958039632492408, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.9501741994712845, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.877405770360049, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.0032868984310923, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.9634813789414771, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.951745598085108, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.0107450533444577, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.9767648040643806, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.421794301244294, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.33729064821617, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7726108743007352, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.146353522607836, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.647727662549414, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.607902689433644, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7856782737143035, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.174674443888669, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.873053286286535, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 40.87802418959342, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7987237394849487, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.202945598935337, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.09771176138956, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.1475965125335, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8117472941312585, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.231166987458913, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.32170486054838, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.416675364576086, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8247489377237258, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.259336807751296, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.54503433300172, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.68525472656292, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.837728670467051, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.287455832990183, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.767701392470496, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 41.95327237089609, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8506867710050159, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.315524927894977, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.989706445492743, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 42.22081053225196, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8636142699644616, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.34354134967046, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.211052544777086, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 42.48781882684898, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8765038240513512, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.371504776135197, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.431740315414366, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 42.75428291152592, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.8893722305542084, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 4.399408540897348, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 28.881965139873998, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.3475161460124845, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 8.952240366448812, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.010724859384638, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 29.11354159882214, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.406217808133725, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.002878191006797, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.047292326666639, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 29.344768488288416, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.464821159747441, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.053424770825107, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.083760809588224, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 29.57566701636356, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.523325903314017, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.103880150218828, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.120145172376134, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 29.80625946148056, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.581740414912474, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.154244372124353, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.156445335664596, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 30.036584285671548, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.640056505107999, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.204539035951335, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.192654506944347, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 30.266642293924154, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.698269198648468, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.254749619778284, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.2287836420591915, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 30.496435210923067, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.756381742086191, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.304869133195641, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.264828356590151, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 30.72597542481984, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.814393044512279, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.354897614259258, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.300775970093309, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 30.955266030894943, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.872295686685728, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 9.404835100051272, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.336656746894629, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 25.596788499076826, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 44.778918153676315, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.32729109462597, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 11.735756420381954, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.133521390388097, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 25.819915800858546, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 45.09329321556146, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.386171404308488, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 11.797434791803802, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.179420492998908, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.042352215946863, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 45.407049595358785, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.444943449954991, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 11.85897253265695, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.225186621371087, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.264091674018218, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 45.72024954031012, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.503603214165121, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 11.920397282333987, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.270836573347054, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.485148483228773, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 46.032844266730265, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.562155681023967, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 11.981681818331758, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.31636526539441, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.70552663515857, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 46.344839924462, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.620599378229265, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 12.042852287223909, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.361761738260107, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 26.925209258194656, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 46.65629243132693, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.678935205666658, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 12.10387626649403, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.40705381800219, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.144212510865284, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 46.96717579287922, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.73715428534808, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 12.164829512578184, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.452206656396115, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.362537627143407, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 47.27751993505251, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.79526960537099, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 12.225668418081636, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.497247188015198, tolerance: 0.9193674699999996
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 27.58019091331392, tolerance: 0.90612332
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 47.58732459802172, tolerance: 0.9145319999999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 7.853245181483906, tolerance: 0.90997283
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 12.286384491386507, tolerance: 0.9154153399999998
positive)
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:532: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 6.542169340498514, tolerance: 0.9193674699999996
positive)
```

get_coefs(grid_search_poly_model_lasso.best_estimator_)[1:30]

alphas = np.linspace(2, 5, num=10)
poly_model_ridge = make_pipeline(
make_column_transformer(
(PolynomialFeatures(include_bias=False), ['n_directions']),
(PolynomialFeatures(include_bias=False), ['n_speak_char']),
(PolynomialFeatures(include_bias=False), ['Number of Cameos']),
remainder = 'passthrough'),
Ridge(fit_intercept = False))
parameters_poly_model_ridge = {
'columntransformer__polynomialfeatures-1__degree': np.arange(1,4,1),
'columntransformer__polynomialfeatures-2__degree': np.arange(1,3,1),
'columntransformer__polynomialfeatures-3__degree': np.arange(1,4,1),
'ridge__alpha': alphas,
}
grid_search_poly_model_ridge = GridSearchCV(poly_model_ridge,
parameters_poly_model_ridge,
cv=kf,
scoring="neg_root_mean_squared_error",
).fit(x_train_scaled, y_train)

get_coefs(grid_search_poly_model_ridge.best_estimator_)[1:30]

x_test = test.drop(columns=['Episode Score'])
y_test =test['Episode Score']

rmse_nslm = model_fit(lm, x_test, y_test, 'Non Scaled Linear Model RMSE: ', plot=False)

rmse_slm = model_fit(lm_scaled, x_test, y_test, 'Scaled Linear Model RMSE: ', plot=False)

rmse_rr_slm = model_fit(lm_scaled_ridge.best_estimator_, x_test, y_test, 'Ridge Regression on Scaled Linear Model RMSE: ', plot=False)

rmse_l_slm = model_fit(lm_scaled_lasso.best_estimator_, x_test, y_test, 'Lasso on Scaled Linear Model RMSE: ', plot=False)

rmse_std_pm = model_fit(grid_search_poly_model.best_estimator_, x_test, y_test, 'Standard Polynomial Model RMSE: ',plot=False)

rmse_l_pm = model_fit(grid_search_poly_model_lasso.best_estimator_, x_test, y_test, 'Lasso Polynomial Model RMSE: ',plot=False)

rmse_rr_pm = model_fit(grid_search_poly_model_ridge.best_estimator_, x_test, y_test, 'Ridge Polynomial Model RMSE: ',plot=False)

rmse_results ={'Method:':['Non-Scaled Linear','Scaled Linear','Ridge Scaled Linear',
'Lasso Scaled Linear','Polynomial','Ridge Polynomial','Lasso Polynomial'],
'RMSE':np.around([rmse_nslm, rmse_slm, rmse_rr_slm, rmse_l_slm, rmse_std_pm, rmse_rr_pm, rmse_l_pm], decimals = 3)
}
rmse_results = pd.DataFrame(rmse_results)
rmse_results.sort_values(by = ['RMSE'])

Method:object | RMSEfloat64 | ||
---|---|---|---|

6 | Lasso Polynomial | 0.258 | |

5 | Ridge Polynomial | 0.275 | |

0 | Non-Scaled Linear | 0.289 | |

1 | Scaled Linear | 0.289 | |

2 | Ridge Scaled Linear | 0.289 | |

3 | Lasso Scaled Linear | 0.289 | |

4 | Polynomial | 0.293 | |

7 rows × 2 columns |

new_d_variables = new_d.drop(columns=['Episode Score'])
print(poly_model_lasso.best_estimator_.coefs_)
variables = new_d_variables.columns.values
variables_list = list(variables)
variables_list.insert(0, 'intercept')
table1 = {'variable:':variables_list,
'coefficients:': coeffs
}
chosen_model = pd.DataFrame(table1).transpose()
chosen_model

AttributeError: 'Pipeline' object has no attribute 'best_estimator_'

coeffs

array_prop_df = pd.DataFrame(array_proportion)
# Find episode in which Michael has the proportion of lines
index = np.argmax(array_prop_df[[0]])
best_line = {'character:': main_chars,
'proportion' : np.around(array_prop_df.iloc[index,:],2)
}
best_line_df = pd.DataFrame(best_line).transpose()
best_line_df

0object | 1object | 2object | 3object | 4object | 5object | 6object | 7object | 8object | 9object | ||
---|---|---|---|---|---|---|---|---|---|---|---|

character: | Michael | Dwight | Jim | Pam | Andy | Angela | Kevin | Erin | Oscar | Ryan | |

proportion | 0.71 | 0.04 | 0.06 | 0.08 | 0.02 | 0.0 | 0.04 | 0.01 | 0.02 | 0.02 | |

2 rows × 10 columns |

# Writer
writer_coeffs = lm_scaled_ridge.best_estimator_.named_steps['ridge'].coef_[5:16]
best_writer = variables[np.argmax(writer_coeffs)+5]
best_writer_coeffs = max(writer_coeffs)
# Director
director_coeffs = lm_scaled_ridge.best_estimator_.named_steps['ridge'].coef_[16:27]
best_director = variables[np.argmax(director_coeffs)+16]
best_director_coeffs = max(director_coeffs)
print('The best writer is', best_writer, 'with coefficient', best_writer_coeffs)
print('The best director is', best_director, 'with coefficient', best_director_coeffs)

```
The best writer is W:Greg Daniels with coefficient 0.00025969552470553217
The best director is D: Paul Feig with coefficient 0.00025879320001047406
```

fig = plt.figure()
ax = plt.axes()
x = np.linspace(0, 60, 1000)
ax.plot(x,chosen_model.iloc[1,0]+chosen_model.iloc[1,1]*x ,
color = 'red',label='n_directions');
ax.plot(x,chosen_model.iloc[1,0]+chosen_model.iloc[1,2]*x ,
color = 'blue',label='n_speak_char');
ax.plot(x,chosen_model.iloc[1,0]+chosen_model.iloc[1,4]*x ,
color = 'green',label='Episode Length');
ax.plot(x,chosen_model.iloc[1,0]+chosen_model.iloc[1,3]*x ,
color = 'cyan',label='Number of Cameos');
plt.ylim(8.6, 10)
plt.xlim(0, max(x))
plt.legend()
plt.title("Continuous Variable in their own dimensional plane")
plt.xlabel("Value")
plt.ylabel("Model Predicted Episode Score")
plt.show()

recc = chosen_model.loc[:, 1:4]
new_int = chosen_model.iloc[1,0]+chosen_model.iloc[1,10]+chosen_model.iloc[1,19]+chosen_model.iloc[1,28]*0.7+chosen_model.iloc[1,29]*0.06+chosen_model.iloc[1,30]*0.04
recc.insert(0, '0', ["Intercept" ,new_int])
recc

IndexError: single positional indexer is out-of-bounds

# Run the following to render to PDF
!crew install pandoc
!jupyter nbconvert --to pdf project1.ipynb

```
/bin/bash: crew: command not found
[NbConvertApp] Converting notebook project1.ipynb to pdf
[NbConvertApp] ERROR | Error while converting 'project1.ipynb'
Traceback (most recent call last):
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 418, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 181, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 199, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/pdf.py", line 169, in from_notebook_node
nb, resources=resources, **kw
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/latex.py", line 77, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 384, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/index.tex.j2", line 8, in top-level template code
((* extends cell_style *))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 176, in top-level template code
\prompt{(((prompt)))}{(((prompt_color)))}{(((execution_count)))}{(((extra_space)))}
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 7, in top-level template code
((*- extends 'document_contents.tex.j2' -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 51, in top-level template code
((*- block figure scoped -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/display_priority.j2", line 5, in top-level template code
((*- extends 'null.j2' -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 30, in top-level template code
((*- block body -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 206, in block "body"
((( super() )))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 32, in block "body"
((*- block any_cell scoped -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 85, in block "any_cell"
((*- block markdowncell scoped-*)) ((*- endblock markdowncell -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 68, in block "markdowncell"
((( cell.source | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'json',extra_args=[]) | resolve_references | convert_pandoc('json','latex'))))
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/filters/pandoc.py", line 24, in convert_pandoc
return pandoc(source, from_format, to_format, extra_args=extra_args)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 52, in pandoc
check_pandoc_version()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 100, in check_pandoc_version
v = get_pandoc_version()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 77, in get_pandoc_version
raise PandocMissing()
nbconvert.utils.pandoc.PandocMissing: Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.html
```