You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The solution file didn't extract the optimal value for k in each model. Below is the code for the extraction of optimal k value:
import operator
two_feat_k_value = {}
three_feat_k_value = {}
four_feat_k_value = {}
five_feat_k_value = {}
six_feat_k_value = {}
dict_ = k_rmse_results.copy()
for k, v in dict_.items():
for key,val in v.items():
if k == '2 best features':
two_feat_k_value[key] = val
elif k == '3 best features':
three_feat_k_value[key] = val
elif k == '4 best features':
four_feat_k_value[key] = val
elif k == '5 best features':
five_feat_k_value[key] = val
else:
six_feat_k_value[key] = val
print('Optimal k-values:')
print('two best features: {}'.format(min(two_feat_k_value.items(), key=operator.itemgetter(1))[1]))
print('three best features: {}'.format(min(three_feat_k_value.items(), key=operator.itemgetter(1))[1]))
print('four best features: {}'.format(min(four_feat_k_value.items(), key=operator.itemgetter(1))[1]))
print('five best features: {}'.format(min(five_feat_k_value.items(), key=operator.itemgetter(1))[1]))
print('six best features: {}'.format(min(six_feat_k_value.items(), key=operator.itemgetter(1))[1]))
The text was updated successfully, but these errors were encountered:
The solution file didn't extract the optimal value for k in each model. Below is the code for the extraction of optimal k value:
The text was updated successfully, but these errors were encountered: