Changelog#
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog (+ the Migration Guide), and this project adheres to Semantic Versioning.
[0.8.0] - 2022-08-09#
Added#
An example on how to use the
dataclassdecorator with tpcp classes. (#41)In case you need complex aggregations of scores across data points, you can now wrap the return values of score functions in custom
Aggregators. The best plac eto learn about this feature is the new “Custom Scorer” example. (#42)
Changed#
Most of the class proccesing and sanity checks now happens in the init (or rather a post init hook) instead of during class initialisation. This increases the chance for some edge cases, but allows to post-process classes, before tpcp checks are run. Most importantly, it allows the use of the
dataclassdecorator in combination with tpcp classes. For the “enduser”, this change will have minimal impact. Only, if you relied on accessing special tpcp class parameters before the class (e.g.__field_annotations__) was initialised, you will get an error now. Other than that, you will only notice a very slight overhead on class initialisation, as we know need to run some basic checks when you call the init orget_params. (#41)The API of the Scorer class was modified. In case you used custom Scorer before, they will likely not work anymore. Further, we removed the
error_scoreparameter from the Scorer and all related methods, that forwarded this parameter (e.g.GridSearch). Error that occur in the score function will now always be raised! If you need special handling of error cases, handle them in your error function yourself (i.e. using try-except). This gives more granular control and makes the implementation of the expected score function returns much easier on thetpcpside. (#42)
[0.7.0] - 2022-06-23#
Added#
The
Datasetclass now has a new parametergroup, which will return the group/row information, if there is only a single group/row left in the dataset. This parameter returns either a string or a namedtuple to make it easy to access the group/row information.The
Dataset.groupsparameter now returns a list of namedtuples when it previously returned a list of normal tuples.New
is_single_groupandassert_is_single_groupmethods for theDatasetclass are added. They are shortcuts for callingself.is_single(groupby_cols=self.groupby_cols)andself.assert_is_single(groupby_cols=self.groupby_cols).
Removed#
We removed the
OptimizableAlgorithmbase class, as it is not really useful. We recommend implementing your own base class or mixin if you are implementing a set of algorithms that need a normal and an optimizable version.
[0.6.3] - 2022-05-31#
It is now possible to use namedtuples as parameters and they are correctly cloned (#39)
[0.6.2] - 2022-04-21#
The poetry lockfiles are now committed to the repository.
Some dependencies are updated
[0.6.1] - 2022-04-05#
Changed#
[0.6.0] - 2022-04-04#
Added#
A new class to wrap the optimization framework Optuna.
CustomOptunaOptimizecan be used to create custom wrapper classes for various Optuna optimizations, that play nicely withtpcpand can be nested within tpcp operations. (#27)A new example for the
CustomOptunaOptimizewrapper that explains how to create complex custom optimizers usingOptunaand the new Scorer callbacks (see below) (#27)Scorernow supports an optional callback function, which will be called after each datapoint is scored. (#29)Pipelines, Optimize objects, and
Scorerare nowGeneric. This improves typing (in particular with VsCode), but means a little bit more typing (pun intended), when creating new Pipelines and Optimizers (#29)Added option for scoring function to return arbitrary additional information using the
NoAggwrapper (#31)(experimental) Torch compatibility for hash based comparisons (e.g. in the
safe_runwrapper). Before the wrapper would fail, with torch module subclasses, as their pickle based hashes where not consistent. We implemented a custom hash function that should solve this. For now, we will consider this feature experimental, as we are not sure if it breaks in certain use-cases. (#33)tpcp.typesnow exposes a bunch of internal types that might be helpful to type custom Pipelines and Optimizers. (#34)
Changed#
The return type for the individual values in the
Scorerclass is notList[float]instead ofnp.ndarray. This also effects the output ofcross_validate,GridSearch.gs_results_andGridSearchCV.cv_results_(#29)cfnow has “faked” return type, so that type checkers in the user code, do not complain anymore. (#29)All TypeVar Variables are now called
SomethingTinstead ofSomething_(#34)
[0.5.0] - 2022-03-15#
Added#
The
make_optimize_safedecorator (and hence, theOptimizemethod) make use of the parameter annotations to check that only parameters marked asOptimizableParameterare changed by theself_optimizemethod. This check also supports nested parameters, in case the optimization involves optimizing nested objects. (#9)All tpcp objects now have a basic representation that is automatically generated based on their parameters (#13)
Added algo optimization and evaluation guide and improved docs overall (#26)
Added examples for all fundamental concepts (#23)
[0.4.0] - 2021-12-13#
In this release the entire core of tcpc was rewritten and a lot of the api was reimagened. This release also has no proper deprecation. This repo will the wild west until the 1.0 release
There are a multitude of changes, that I do not remember all. Here is the list of most important things:
A lot of the import paths have changed. It is likely that you need to update some imports
A new way to resolve the mutable default issue was introduced. It uses a explicit factory. To make that more clear, the name for mutable wrapper has changed from
mdf->cfor fromdefault->CloneFactoryThe overall class API got a lot slimmer. A bunch of methods like
get_attributes, are now functions that can be called with the class or instance as argument. Most methods were further renamed to represent there meaning in the context oftpcp. For example,get_attributes->get_resultsThe new concept of Parameter Annotation was added. You can add type annotations with the types
Parameter,HyperParameter,OptimizableParameter, orPureParameterto a class parameter to indicate its role for the algorithm. This is in particularly helpful for optimizable Pipelines and algorithms. Wrapper methods can then use these annotations to run implementation checks and optimizations. The only method that uses these at the momement isGridSearchCV. It now allows to setpure_parameterstoTrue, which will collect the list of all attributes annotated withPureParameterand use this information for performance optimization. Before, you needed to specify the list of pure parameters manually.Some core classes where renamed:
BaseAlgorithm->Algorithm,SimplePipeline->PipelineThe decorators to make
runandself_optimizesafe are now reimagened and renamed tomake_run_safeandmake_optimize_safe