Closed FeGeyer closed 5 years ago
So we have to change this line: https://github.com/scikit-learn/scikit-learn/blob/7813f7efb5b2012412888b69e73d76f2df2b50b6/sklearn/model_selection/_validation.py#L512
The function _fit_and_score' is called by
GridSearch`:
https://github.com/scikit-learn/scikit-learn/blob/7813f7efb5b2012412888b69e73d76f2df2b50b6/sklearn/model_selection/_search.py#L659
Ideas:
use loss_and_metrics
with model.evaluate_generator
, add this to predict
-method?
Take maximum 3 different inputs of optimizing parameters
use every combination with np.meshgrid,
in special: np.stack(np.meshgrid([1, 2, 3], [4, 5], [6, 7]), -1).reshape(-1, - 3)
die totale Anzahl an Kombinationen ist hierbei die Multiplikation der Anzahl der zu varierenden Parameter
loop over every variation
save loss and accuracy plots and the value of loss_and_metrics
in different folders
use loss_and_metrics with model.evaluate_generator, add this to predict-method?
To be more flexible I would create a new. However, if you have to copy paste code you should consider to outsource this code in a function to avoid unnecessary code.
use every combination with np.meshgrid, in special: np.stack(np.meshgrid([1, 2, 3], [4, 5], [6, 7]), -1).reshape(-1, - 3)
Why np.stack()
?
save loss and accuracy plots and the value of loss_and_metrics in different folders
We should think about a handy naming convention
Here a short suggestion on how to create the .json
file.
I am refering to the code starting here: https://github.com/beckstev/MachineLearningSeminar/blob/283e363ef69454e8ec26c94e6e16959db07d2eb9/dog_classifier/net/train.py#L51
BTW
Why do you use here .tolist()
?
https://github.com/beckstev/MachineLearningSeminar/blob/283e363ef69454e8ec26c94e6e16959db07d2eb9/dog_classifier/net/train.py#L58
My suggestion:
loss_dict = dict()
loss_dict['min_loss'] = min(df_history['loss'].values)
loss_dict['max_acc']= max(df_history['acc'].values)
loss_dict['min_val_loss'] = min(df_history['val_loss'].values)
los_dict['max_val_acc'] = max(df_history['val_acc'].values)
# final values
loss_dict ['acc'] = df_history['acc'].tail(1).values
loss_dict['loss']= df_history['loss'].tail(1).values
loss_dict['val_acc'] = df_history['val_acc'].tail(1).values
loss_dict['val_loss'] = df_history['val_loss'].tail(1).values
with open(model_save_path + '/loss_acc.json', 'w') as json_file:
json.dump(loss_dict , json_file)
DISCLAIMER: I did not test this code at all, however I optimistic that it will work. If not, please post the error.
Habe für die final values noch [0]
ergänzt, dann funktioniert es gut. Danke!
The final version #30
This is a problem, which have some slightly different solutions, but the main problem is in my opinion, that we dont have the parameters
x
andy
for fitting, but objects of typeDataGenerator
. Some Links with solutionsWithout sparse matrices
With sparse matrices as input
Leicht abgewandelte Lösung im Bezug auf obigen Link
Source Code of GridSearch