Skip to content

Commit

Permalink
Merge branch 'release/v0.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Panchenko committed Feb 18, 2021
2 parents 3f1b420 + 2cd7ca2 commit 5ac98c3
Show file tree
Hide file tree
Showing 70 changed files with 3,292 additions and 575 deletions.
44 changes: 22 additions & 22 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[bumpversion]
current_version = 0.0.7
commit = False
tag = False
allow_dirty = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{build}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = prod
first_value = dev
values =
dev
prod

[bumpversion:part:build]

[bumpversion:file:setup.py]

[bumpversion:file:src/sensai/__init__.py]
[bumpversion]
current_version = 0.0.5
commit = False
tag = False
allow_dirty = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{build}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = prod
first_value = dev
values =
dev
prod

[bumpversion:part:build]

[bumpversion:file:setup.py]

[bumpversion:file:src/sensai/__init__.py]
1 change: 1 addition & 0 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: Checkout LFS Objects
run: git lfs pull
- name: Merge develop into current branch
if: github.ref != 'refs/heads/develop'
run: |
git fetch origin develop:develop --update-head-ok
git merge develop
Expand Down
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__config_instance = None

source_path = os.path.dirname(__file__)
topLevelDirectory = os.path.dirname(__file__)


class __Configuration:
Expand All @@ -33,7 +33,7 @@ def __init__(self, config_files: List[str] = None):
config_files = ["config.json", "config_local.json"]
self.config = {}
for filename in config_files:
file_path = os.path.join(source_path, filename)
file_path = os.path.join(topLevelDirectory, filename)
if os.path.exists(file_path):
self.log.info("Reading configuration from %s" % file_path)
with open(file_path, 'r') as f:
Expand Down
3 changes: 3 additions & 0 deletions data/raw/mnist_train.csv.zip
Git LFS file not shown
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys
import ast
import logging
import os
import sys

import pkg_resources

Expand Down Expand Up @@ -103,6 +103,7 @@ def findLineFromObjectName(sourceFile, objectName):

autodoc_mock_imports = [
"torch",
"pytorch_lightning",
"torchtext",
"tensorflow",
"lightgbm",
Expand All @@ -115,7 +116,8 @@ def findLineFromObjectName(sourceFile, objectName):
"mlflow",
"MySQLdb",
"catboost",
"trains",
"clearml",
"azure"
]

# Render docu of __init__ methods
Expand Down
2 changes: 1 addition & 1 deletion docs/sensai/data_ingest.rst → docs/sensai/data.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data\_ingest
============

.. automodule:: sensai.data_ingest
.. automodule:: sensai.data
:members:
:undoc-members:
11 changes: 11 additions & 0 deletions docs/sensai/pytorch_lightning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pytorch\_lightning
==================

.. automodule:: sensai.pytorch_lightning
:members:
:undoc-members:

.. toctree::
:glob:

pytorch_lightning/*
6 changes: 6 additions & 0 deletions docs/sensai/pytorch_lightning/pl_models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pl\_models
==========

.. automodule:: sensai.pytorch_lightning.pl_models
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/sensai/tensor_model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tensor\_model
=============

.. automodule:: sensai.tensor_model
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/sensai/tracking/clearml_tracking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
clearml\_tracking
=================

.. automodule:: sensai.tracking.clearml_tracking
:members:
:undoc-members:
6 changes: 0 additions & 6 deletions docs/sensai/tracking/trains_tracking.rst

This file was deleted.

6 changes: 6 additions & 0 deletions docs/sensai/util/pandas.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pandas
======

.. automodule:: sensai.util.pandas
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/sensai/util/sequences.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sequences
=========

.. automodule:: sensai.util.sequences
:members:
:undoc-members:
1 change: 1 addition & 0 deletions notebooks/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.ipynb_checkpoints
lightning_logs
17 changes: 5 additions & 12 deletions notebooks/Clustering Evaluation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"import os\n",
"from pprint import pprint\n",
"from sklearn.cluster import DBSCAN\n",
"from hdbscan import HDBSCAN\n",
"import seaborn as sns\n",
"import geopandas as gp\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -141,8 +140,8 @@
"For model selection we need to compare different (or differently parametrized) models that were\n",
"trained on the same dataset. The `ClusteringEvaluator` abstraction was designed with this goal in mind.\n",
"The evaluator can be used to obtain evaluation statistics for different models that are guaranteed\n",
"to be comparable with each other (always computed by the same object in the same way). Here an example comparing\n",
"hdbscan and dbscan performances"
"to be comparable with each other (always computed by the same object in the same way). Here an example evaluating\n",
"a dbscan performance on metrics that don't necessitate ground truth labels"
]
},
{
Expand All @@ -155,12 +154,9 @@
},
"outputs": [],
"source": [
"hdbscan = SKLearnCoordinateClustering(HDBSCAN(min_cluster_size=100, min_samples=20, cluster_selection_epsilon=150))\n",
"\n",
"modelEvaluator = ClusteringModelUnsupervisedEvaluator(coordinatesDF)\n",
"\n",
"dbscanEvalStats = modelEvaluator.evalModel(dbscan, fit=False) # dbscan was already fitted on this data\n",
"hdbscanEvalStats = modelEvaluator.evalModel(hdbscan)\n"
"dbscanEvalStats = modelEvaluator.evalModel(dbscan, fit=False) # dbscan was already fitted on this data"
]
},
{
Expand All @@ -174,10 +170,7 @@
"outputs": [],
"source": [
"print(\"dbscan_performance: \\n\")\n",
"pprint(dbscanEvalStats.getAll())\n",
"print(\"\")\n",
"print(\"hdbscan_performance: \\n\")\n",
"pprint(hdbscanEvalStats.getAll())"
"pprint(dbscanEvalStats.getAll())"
]
},
{
Expand Down Expand Up @@ -507,7 +500,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.7.7"
}
},
"nbformat": 4,
Expand Down
16 changes: 8 additions & 8 deletions notebooks/Intro to sensAI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"from sensai import VectorRegressionModel\n",
"from sensai.data_transformation import DFTNormalisation\n",
"from sensai.evaluation.eval_util import createVectorModelEvaluator\n",
"from sensai.data_ingest import InputOutputData\n",
"from sensai.tracking.trains_tracking import TrackedTrainsExperiment\n",
"from sensai.data import InputOutputData\n",
"from sensai.tracking.clearml_tracking import ClearMLExperiment\n",
"import sensai.featuregen as fgen\n",
"import matplotlib.pyplot as plt\n",
"\n",
Expand Down Expand Up @@ -269,7 +269,7 @@
" )\n",
" )\n",
"\n",
" def fit(self, X: pd.DataFrame, Y: pd.DataFrame, ctx=None):\n",
" def _fit(self, X: pd.DataFrame, Y: pd.DataFrame, ctx=None):\n",
" self.threshold = X[self.tax_column].median()\n",
"\n",
" def compensate_for_fraud(self, tax: float):\n",
Expand Down Expand Up @@ -445,9 +445,9 @@
"## Model Evaluation\n",
"\n",
"sensAI has extensive support for evaluating different types of models with different methods, including\n",
"cross validation. The evaluation has native support for experiment tracking frameworks, like trains or MLflow.\n",
"Here we will use trains, so after running this notebook you will be able to see the result in the\n",
"trains demo-server.\n",
"cross validation. The evaluation has native support for experiment tracking frameworks, like clearML or MLflow.\n",
"Here we will use clearML, so after running this notebook you will be able to see the result in the\n",
"clearML demo-server.\n",
"\n",
"The evaluation is generally based on the following structure: an `Evaluator` object holds a dataset.\n",
"An `Evaluator` can evaluate multiple models by calling `Evaluator.evalModel(model)`,\n",
Expand All @@ -471,10 +471,10 @@
"source": [
"io_data = InputOutputData(X, y)\n",
"\n",
"trains_experiment = TrackedTrainsExperiment(projectName=\"sensai_demo\", taskName=\"custom_model\")\n",
"clearml_experiment = ClearMLExperiment(projectName=\"sensai_demo\", taskName=\"custom_model\")\n",
"evaluator = createVectorModelEvaluator(io_data, isRegression=custom_model.isRegressionModel(),\n",
" testFraction=0.2)\n",
"evaluator.setTrackedExperiment(trains_experiment)"
"evaluator.setTrackedExperiment(clearml_experiment)"
],
"metadata": {
"collapsed": false,
Expand Down
Loading

0 comments on commit 5ac98c3

Please sign in to comment.