Conversation
|
Looks decent, all makes sense The testing of forecasting via reduction is cool too A part of me I don't like is thinking to abstract to a ...Predictor class, with fit/predict that Classifier/Regressor extend, but the rest of me says there's nothing to gain and it'd be a waste of time. |
|
Like an MLPPredictor that MLPClassifier and MLPRegressor extend? Maybe it could work using an MLPPredictorMixin (like the mixin classes of sklearn). I’ll have a look, it might be a neat way to handle the network’s parameters. |
|
All looks good to me, the only thing I'm not sure about is the folder structure, |
|
Folder structure: yes that could work. It would look like:
and in sktime |
|
Seems like a lot of folder name duplications. But perhaps still better than the alternatives. One alternative would be to follow scikit-learn and abandon the classifiers/regressor folder divide and go with a category which contains both classifiers and regressors. Not sure what a good category would be, though. Perhaps |
|
Yes, the sklearn folder structure might work well. In sklearn there is a file: Then there are separate folders under sklearn for each type of algorithm
sklearn-dl could be simililarly structured with
and then the architectures go in folders like
This would keep all CNN code in one place, not split over 3+ folders. In fact, the deeplearning level could be dropped, since sktime-dl implies deeplearning, leaving
The structure above is like sklearn but is less like the sktime structure (where the distance_based folders live). Let me know what you think. |
|
Yes, for For |
…base classifier to base/estimators/_classifier.py. Tests pass.
…ase regressor to base/estimators/_regressor.py. Tests pass.
…e (e.g. a network without its final layer) into deeplearning/[architecture name]. Moved base network to base/estimators/_network.py. Tests pass.
|
Work in progress..... |
…hey take on Travis.
|
I've thought about the folder structure for base sktime, let me know what you think: #229 |
|
Thanks for the invitation to look at #229 . It seems there are strong arguments for sticking with the current folders for classifiers, regressors, etc. Therefore, you could put them as they are in an estimators folder. The other shared code that you mention is specific to tasks so could go in a tasks folder. Does this task code need to add functionality to each estimator? It might be appropriate to use the Decorator design pattern. |
…t data moved to adjust_parameters(X) and extra adjustment added to handle the short series that might be used for forecasting. Modified slice_data() to handle y that can be regression values or int class labels and where y can be 1D array (regression) or 2D array (classification). Modified pre_processing() to handle y that can be 1D array or 2D array.
|
Failing on TF 1.15 with "tensorflow.python.framework.errors_impl.InvalidArgumentError: Tensor input_8:0, specified in either feed_devices or fetch_devices was not found in the Graph" |
|
Thanks for your comments! Forecasters are estimators like classifiers or regressors, and so would be segmentors or event modellers (i.e. probabilistic forecasters). While any regressor can be used to solve a forecasting task (via reduction), there are also specific forecasting algorithms which we want to include (e.g. exponential smoothing). So decorating regressors with forecasting functionality wouldn't be enough, no? Currently, we're encapsulating reduction from forecasting to regression as a meta-forecaster that works with any regressors (see this #218 for work in progress). You suggest to group by function (i.e. estimation, model selection, etc.), rather than task/setting, so if we include forecasters in estimators, this could look like this: But then I'm not sure how to organise model selection and other composition methods specific to the task/setting (e.g. a SlidingWindowSplitter used when evaluating forecasting models but not useful for evaluating other performance on other tasks). I also don't like the idea of giving up the classifier and regressors folder on the top level and putting it inside some much more obscure "series_as_features" module, but can't think of anything better at the moment. |
|
Scatter brain/rambling/not fully formed thoughts ahead, sorry Ultimately there's going to be redundancy somewhere in the structure most likely, question is what redundancy do you want to accept. In what ways can these things reasonably be grouped?
1.2 Output only?
Others? 4 is certainly the weakest (or maybe most niche?) grouping IMO, but parties want it in. I'd argue for 2 being the strongest. There's the question of whether prediction (or whatever name it could be) should be an encapsulating folder, or instead if classification,regression... should be their own top level folders, but yeah you need somewhere to put base.py for estimators so it makes sense for the prediction containing folder to be there really. Then when it comes to which redundancy to accept in relation to e.g. specific evaluation methods as per example above, you probably repeat the classification,regression... categories in each of composition, selection etc. as needed If you argue for 3 being the strongest grouping over 2, you flip the priority of classification,regression etc and put that on top level, while duplicating prediction,evaluation,composition directories In terms of usage, the imports for some experiment you want to run would then be something like and so on. From the point of view of a user, the redundancy might not even be that unattractive really, makes it obvious what methods can be shared between prediction tasks and what are specific. So long as you ignore any code that might be useful for more than one but not all prediction tasks... |
|
Thanks, I like that structure too! One issue is that classification and regression (and to some extent clustering) share composition and tuning functionality, so it doesn't make much sense to put this into Anyway, before we go on here, would you mind posting that into the other issue thread? @Withington please feel free to comment on the other issue as well! |
|
This seems like a good time to merge this pull request. Seven regressors have been created. The outstanding three are MCDCNN, MCNN and TWIESN. I can work on these but they require a bit more attention: MCDCNN
MCNN
TWIESN
Could you please review the current pull request and consider merging it to dev? There are now a lot of changes so feel free to ask me about it. I kept it fairly clean by moving entire blocks of code from |
mloning
left a comment
There was a problem hiding this comment.
Great work! I've left a few minor comments, but overall looks good to me!
|
|
||
|
|
||
| class BaseDeepRegressor(BaseRegressor, RegressorMixin): | ||
| model_save_directory = None |
There was a problem hiding this comment.
Why do we want the model_save_directory as a class attribute?
There was a problem hiding this comment.
BaseDeepClassifier already had model_save_directory as a class attribute so it is included in BaseDeepRegressor too.
self.save_trained_model() is always called at the end of fit(X, y) and the model is saved if model_save_directory is not None.
It is also used occasionally in callbacks, e.g. ResNet and TLeNet keras.callbacks.ModelCheckpoint
I wouldn't put model_save_directory in BaseDeepNetwork because a network is incomplete, it's not a full model.
Does that answer your question or did you have something else in mind?
There was a problem hiding this comment.
I'm not sure why it's defined on the class and not the instance level?
There was a problem hiding this comment.
Good question. Perhaps all BaseDeepRegressor and BaseDeepClassifier class attributes need to be moved to the instance level? Currently we have:
class BaseDeepClassifier(BaseClassifier):
classes_ = None
nb_classes = None
model_save_directory = None
model = None
model_name = None
Any reason why it would need to stay like this? Memory considerations? @james-large ?
I'll try it locally and test it.
There was a problem hiding this comment.
Class attributes moved to instance attributes and __init__ calls updated accordingly. What do you make of it?
There was a problem hiding this comment.
Looks good to me, happy to merge once @james-large has reviewed it! :-)
There was a problem hiding this comment.
This makes more sense for sure, problem of poor python-esque code understanding back then on my part probably
…ance because BaseDeepRegressor already inherits it.
|
Comments above. Please hit the "Resolve conversation" button if my replies cover your points satisfactorily. |
|
I'm happy. Nice work @Withington. Added some comments to the individual queries above, I reckon everything's fine as is. Shall we get this into dev and then look into the dev branch TS problems if they still persist? Will leave this up for another couple hours or so while I head home in case of any sudden changes of heart, and merge it in |
|
Thanks for the merge! 😃 What are the "dev branch TS problems" @james-large ? I'm not sure what TS is. |
|
Ah meant tf, tensorflow. There was some problem with the tf2.x version of the travis checks iirc? No matter, looks fixed, maybe it was long ago or I imagined it. Brain's still recovering |
|
TF 2.0 was fine, that is in dev branch now.
|
Reference Issues/PRs
Fixes #18
What does this implement/fix? Explain your changes.
Draft pull request: do not merge. Please review the structure of the new regressors and networks folders and classes. These enable regressors and classifiers to be built using the same code to define the main part of their networks.
Any other comments?
save_trained_modelI look forward to your feedback.