-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add model_type validations (#52)
* chore: add model_type validations * chore: add model_type validations * doc: postgres installation required for local test * chore: add authors.md and its related automation script * chore: add a Github Actions in order to automate update-authors.sh executions * chore: refactoring tests
- Loading branch information
Showing
10 changed files
with
387 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Update Authors | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
update-authors: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run update-authors.sh script file | ||
run: | | ||
chmod +x ./tools/update-authors.sh | ||
./tools/update-authors.sh | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- | ||
Copyright (c) radicalbit-ai-monitoring contributors. | ||
Licensed under https://github.com/radicalbit/radicalbit-ai-monitoring/blob/main/LICENSE | ||
--> | ||
|
||
Contributors to radicalbit-ai-monitoring | ||
============================ | ||
radicalbit-ai-monitoring is developed and maintained by a community of people interested in providing a comprehensive solution for monitoring your Machine Learning and Large Language Models in production. | ||
|
||
|
||
<p align="center"> | ||
<img src="https://contributors-img.web.app/image?repo=radicalbit/radicalbit-ai-monitoring" width = "500"/> | ||
</p> | ||
|
||
|
||
Contributors (ordered by first contribution.) | ||
------------------------------------- | ||
[Full List of Contributors](https://github.com/radicalbit/radicalbit-ai-monitoring/graphs/contributors) | ||
|
||
- Paolo Filippelli (<[email protected]>) | ||
- Roberto Bentivoglio (<[email protected]>) | ||
- paoloyx (<[email protected]>) | ||
- Luca Tagliabue (<[email protected]>) | ||
- Mauro Cortellazzi (<[email protected]>) | ||
- Stefano Zamboni (<[email protected]>) | ||
- mmariniello90 (<[email protected]>) | ||
- Davide Valleri (<[email protected]>) | ||
- Lorenzo D'Agostino (<[email protected]>) | ||
- Daniele Tria (<[email protected]>) | ||
- rivamarco (<[email protected]>) | ||
- d-croci (<[email protected]>) | ||
- bigmoby (<[email protected]>) | ||
|
||
#### Generated by tools/update-authors.sh. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Any, Optional | ||
|
||
from app.models.inferred_schema_dto import SupportedTypes | ||
|
||
|
||
def is_number(value: SupportedTypes): | ||
return value in (SupportedTypes.int, SupportedTypes.float) | ||
|
||
|
||
def is_number_or_string(value: SupportedTypes): | ||
return value in (SupportedTypes.int, SupportedTypes.float, SupportedTypes.string) | ||
|
||
|
||
def is_optional_float(value: Optional[SupportedTypes] = None) -> bool: | ||
return value in (None, SupportedTypes.float) | ||
|
||
|
||
def is_none(value: Any) -> bool: | ||
return value is None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from app.models.inferred_schema_dto import SupportedTypes | ||
from app.models.model_dto import ( | ||
ColumnDefinition, | ||
DataType, | ||
Granularity, | ||
ModelType, | ||
OutputType, | ||
) | ||
|
||
|
||
def get_model_sample_wrong(fail_field: str, model_type: ModelType): | ||
prediction = None | ||
prediction_proba = None | ||
if fail_field == 'outputs.prediction' and model_type == ModelType.BINARY: | ||
prediction = ColumnDefinition(name='pred1', type=SupportedTypes.string) | ||
elif fail_field == 'outputs.prediction' and model_type == ModelType.MULTI_CLASS: | ||
prediction = ColumnDefinition(name='pred1', type=SupportedTypes.datetime) | ||
elif fail_field == 'outputs.prediction' and model_type == ModelType.REGRESSION: | ||
prediction = ColumnDefinition(name='pred1', type=SupportedTypes.string) | ||
else: | ||
prediction = ColumnDefinition(name='pred1', type=SupportedTypes.int) | ||
|
||
if ( | ||
fail_field == 'outputs.prediction_proba' | ||
and model_type == ModelType.BINARY | ||
or fail_field == 'outputs.prediction_proba' | ||
and model_type == ModelType.MULTI_CLASS | ||
): | ||
prediction_proba = ColumnDefinition(name='prob1', type=SupportedTypes.int) | ||
elif ( | ||
fail_field == 'outputs.prediction_proba' and model_type == ModelType.REGRESSION | ||
): | ||
prediction_proba = ColumnDefinition(name='prob1', type=SupportedTypes.float) | ||
else: | ||
prediction_proba = ColumnDefinition(name='prob1', type=SupportedTypes.float) | ||
|
||
target: ColumnDefinition = None | ||
if fail_field == 'target' and model_type == ModelType.BINARY: | ||
target = ColumnDefinition(name='target1', type=SupportedTypes.string) | ||
elif fail_field == 'target' and model_type == ModelType.MULTI_CLASS: | ||
target = ColumnDefinition(name='target1', type=SupportedTypes.datetime) | ||
elif fail_field == 'target' and model_type == ModelType.REGRESSION: | ||
target = ColumnDefinition(name='target1', type=SupportedTypes.string) | ||
else: | ||
target = ColumnDefinition(name='target1', type=SupportedTypes.int) | ||
|
||
timestamp: ColumnDefinition = None | ||
if fail_field == 'timestamp': | ||
timestamp = ColumnDefinition(name='timestamp', type=SupportedTypes.string) | ||
else: | ||
timestamp = ColumnDefinition(name='timestamp', type=SupportedTypes.datetime) | ||
|
||
return { | ||
'name': 'model_name', | ||
'model_type': model_type, | ||
'data_type': DataType.TEXT, | ||
'granularity': Granularity.DAY, | ||
'features': [ColumnDefinition(name='feature1', type=SupportedTypes.string)], | ||
'outputs': OutputType( | ||
prediction=prediction, | ||
prediction_proba=prediction_proba, | ||
output=[ColumnDefinition(name='output1', type=SupportedTypes.string)], | ||
), | ||
'target': target, | ||
'timestamp': timestamp, | ||
'frameworks': None, | ||
'algorithm': None, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.