Skip to content

Commit

Permalink
docs: new version
Browse files Browse the repository at this point in the history
  • Loading branch information
f-aguzzi committed Jun 4, 2024
1 parent d06a7db commit 7c96050
Show file tree
Hide file tree
Showing 126 changed files with 1,437 additions and 50 deletions.
173 changes: 143 additions & 30 deletions docs/cookbook/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,148 @@ In this cookbook page, you will be shown how the project is structured, and the

```
chemfusekit
|
|_lda
| |_LDASettings
| |_LDA
|
|_lr
| |_LRSettings
| |_LR
|
|_plsda
| |_PLSDASettings
| |_PLSDA
|
|_pca
| |_PCASettings
| |_PCA
|
|_lldf
| |_LLDFSettings
| |_LLDF
| |_LLDFModel
|
|_svm
| |_SVMSettings
| |_SVM
|
|_knn
|_KNNSettings
|_KNN
├── lda
│ ├── LDASettings
│ └── LDA
├── lr
│ ├── LRSettings
│ └── LR
├── plsda
│ ├── PLSDASettings
│ └── PLSDA
├── pca
│ ├── PCASettings
│ ├── PCA
│ └── PCADataModel
├── lldf
│ ├── LLDFSettings
│ ├── LLDF
│ └── LLDFDataModel
├── svm
│ ├── SVMSettings
│ └── SVM
└── knn
├── KNNSettings
└── KNN
```

As you can see, each module contains a class with the same name of the module, and a settings class. That's because this project tries to be as modular and as regular as possible, for clarity and interoperability.
As you can see, each module contains a class with the same name of the module, and a settings class. That's because this project tries to be as modular and as regular as possible, for clarity and interoperability.


## Modular design features

The settings for all classifiers (that is, all classes except `LLDF` and `PCA`) inherit from a base class called [`BaseSettings`](/docs/base/basesettings) in the `base` module:

```mermaid
classDiagram
class BaseSettings {
+output: GraphMode
+test_split: bool
__init__(output, test_split)
}
class KNNSettings {
...
}
class LDASettings {
...
}
class LRSettings {
...
}
class PLSDASettings {
...
}
class SVMSettings {
...
}
BaseSettings *-- KNNSettings
BaseSettings *-- LDASettings
BaseSettings *-- LRSettings
BaseSettings *-- PLSDASettings
BaseSettings *-- SVMSettings
```

\
\
The classifiers themselves all inherit from a base class called [`BaseClassifier`](/docs/base/baseclassifier) in the `base` module:

```mermaid
classDiagram
class BaseClassifier {
+settings: BaseSettings
+data: BaseDataModel
+model: sklearn model
__init__(settings, data)
import_model(import_path: str)
export_model(export_path: str)
}
class KNN {
...
}
class LDA {
...
}
class LR {
...
}
class PLSDA {
...
}
class SVM {
...
}
BaseClassifier *-- KNN
BaseClassifier *-- LDA
BaseClassifier *-- LR
BaseClassifier *-- PLSDA
BaseClassifier *-- SVM
```

\
\
The data types are modular and interexchangeable too. Both [`LLDFDataModel`](/docs/lldf/lldfdatamodel) and [`PCADataModel`](/docs/pca/pcadatamodel) inherit from [`BaseDataModel`](/docs/base/basedatamodel) as shown in the following diagram:

```mermaid
classDiagram
class BaseDataModel {
+x_data: DataFrame
+x_train: DataFrame
+y: ndarray
__init__(x_data, x_train, y)
}
class LLDFDataModel {
...
__init__(...)
}
class PCADataModel {
+array_scores: ndarray
__init__(..., array_scores)
}
BaseDataModel *-- LLDFDataModel
BaseDataModel *-- PCADataModel
```

This allows all the classifiers to use the `LLDF` data, dimension-reduced `PCA` data, or any other type of data as long as it follows the `BaseDataModel` template.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ classDiagram

\
\
The classifiers themselves all inherit from a base class called [`BaseClassifier`](/docs/base/baseclassifier) in the `base` module:
The classifiers themselves, except `LR`, all inherit from a base class called [`BaseClassifier`](/docs/base/baseclassifier) in the `base` module:

```mermaid
classDiagram
Expand All @@ -108,10 +108,6 @@ classDiagram
...
}
class LR {
...
}
class PLSDA {
...
}
Expand Down Expand Up @@ -145,13 +141,7 @@ classDiagram
__init__(...)
}
class PCADataModel {
+array_scores: ndarray
__init__(..., array_scores)
}
BaseDataModel *-- LLDFDataModel
BaseDataModel *-- PCADataModel
```

This allows all the classifiers to use the `LLDF` data, dimension-reduced `PCA` data, or any other type of data as long as it follows the `BaseDataModel` template.
This allows all the classifiers to use the `LLDF` data, or any other type of data as long as it follows the `BaseDataModel` template.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 3
---

# Case study: training a classifier from lab data

:::note
This case study is still **under construction**.
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 4
---

# Case study: hybrid workflow

:::note
This case study is still **under construction**.
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 5
---

# Case study: real-time data classification

:::note
This case study is still **under construction**.
:::
26 changes: 26 additions & 0 deletions docs/cookbook_versioned_docs/version-2.1.0/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
sidebar_position: 1
---

# The ChemFuseKit Cookbook: an introduction

*What is a cookbook, exactly?*

> A cookbook is a comprehensive collection of recipes that guide users through
the process of learning and mastering the use of a specific library or
programming technique, by providing step-by-step instructions, explanations and
examples.

## What you'll learn

In this cookbook you will learn the basic principles of operation of `ChemFuseKit` through practical examples and case studies. You will be shown that all modules follow a basic structure, and once you've learned it for one module, you will be able to reapply that knowledge for all modules.

You will be shown how to use the library on its own, and also how to use it as a part of a bigger pipeline.

## Cookbook sectioning

Here we go:

- first of all, you will be shown the basic principles and structure;
- then, you will be shown three case studies;
- finally, you'll receive instructions on how to modify and expand this library for your own purposes.
44 changes: 44 additions & 0 deletions docs/cookbook_versioned_docs/version-2.1.0/structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
sidebar_position: 2
---

# Project structure

In this cookbook page, you will be shown how the project is structured, and the purpose of each module.

## Project Hierarchy

```
chemfusekit
|
|_lda
| |_LDASettings
| |_LDA
|
|_lr
| |_LRSettings
| |_LR
|
|_plsda
| |_PLSDASettings
| |_PLSDA
|
|_pca
| |_PCASettings
| |_PCA
|
|_lldf
| |_LLDFSettings
| |_LLDF
| |_LLDFModel
|
|_svm
| |_SVMSettings
| |_SVM
|
|_knn
|_KNNSettings
|_KNN
```

As you can see, each module contains a class with the same name of the module, and a settings class. That's because this project tries to be as modular and as regular as possible, for clarity and interoperability.
3 changes: 2 additions & 1 deletion docs/cookbook_versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[
"2.0"
"2.1.0",
"2.0.0"
]
1 change: 1 addition & 0 deletions docs/docs/lldf/lldfmodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LLDFModel(x_data: pd.DataFrame, x_train: pd.DataFrame, y: np.ndarray)
The first two are `Pandas` `DataFrame` objects:
- `x_data`
- `x_train`

The last is a `NumPy` `ndarray`:
- `y`

1 change: 1 addition & 0 deletions docs/docs/pca/pcadatamodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PCAModel(x_data: pd.DataFrame, x_train: pd.DataFrame, y: np.ndarray, array_score
The first two are `Pandas` `DataFrame` objects:
- `x_data`
- `x_train`

The last two are `NumPy` `ndarray`s:
- `y`
- `array_scores`
15 changes: 10 additions & 5 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,23 @@ const config = {
label: 'Project',
position: 'left',
},
{
to: 'blog',
label: 'Blog',
position: 'right'
},
{
type: 'docSidebar',
docsPluginId: 'cookbook',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Cookbook',
},
{
type: 'docsVersionDropdown',
label: 'Docs version',
position: 'right'
},
{
to: 'blog',
label: 'Blog',
position: 'right'
},
{
href: 'https://github.com/f-aguzzi/tesi',
label: 'GitHub',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions docs/versioned_docs/version-2.1.0/base/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Base module",
"position": 9,
"link": {
"type": "generated-index",
"description": "A module containing base classes for all the other modules."
}
}
Loading

0 comments on commit 7c96050

Please sign in to comment.