From 64b2c202ea3b33b5d19a30ae6393928543156051 Mon Sep 17 00:00:00 2001 From: Patricio Cerda Mardini Date: Mon, 25 Dec 2023 19:39:08 +0900 Subject: [PATCH 1/2] fix: add compatibility for type-infer==0.0.18 --- .../tutorial_data_analysis/tutorial_data_analysis.ipynb | 4 ++-- lightwood/api/high_level.py | 4 ++-- lightwood/encoder/text/short.py | 2 +- tests/unit_tests/encoder/text/test_short.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docssrc/source/tutorials/tutorial_data_analysis/tutorial_data_analysis.ipynb b/docssrc/source/tutorials/tutorial_data_analysis/tutorial_data_analysis.ipynb index 32739df69..f24944815 100644 --- a/docssrc/source/tutorials/tutorial_data_analysis/tutorial_data_analysis.ipynb +++ b/docssrc/source/tutorials/tutorial_data_analysis/tutorial_data_analysis.ipynb @@ -295,10 +295,10 @@ } ], "source": [ - "from type_infer.infer import infer_types\n", + "from type_infer.api import infer_types\n", "from type_infer.base import TypeInformation\n", "\n", - "type_information = infer_types(df, problem_definition.pct_invalid)\n", + "type_information = infer_types(df, config={'engine': 'rule_based', 'pct_invalid': problem_definition.pct_invalid})\n", "\n", "{field.name for field in fields(TypeInformation)} # show the fields this dataclass has" ] diff --git a/lightwood/api/high_level.py b/lightwood/api/high_level.py index 36d2dd9b3..17e7c36dd 100644 --- a/lightwood/api/high_level.py +++ b/lightwood/api/high_level.py @@ -4,7 +4,7 @@ import pandas as pd from lightwood.api.types import JsonAI, ProblemDefinition from dataprep_ml.insights import statistical_analysis -from type_infer.infer import infer_types +from type_infer.api import infer_types from lightwood.api.predictor import PredictorInterface from lightwood.api.json_ai import generate_json_ai from lightwood.helpers.codegen import code_from_json_ai as _code_from_json_ai, _module_from_code, _predictor_from_code @@ -65,7 +65,7 @@ def json_ai_from_problem(df: pd.DataFrame, problem_definition: Union[ProblemDefi log.info(f'Dropping features: {problem_definition.ignore_features}') df = df.drop(columns=problem_definition.ignore_features) - type_information = infer_types(df, problem_definition.pct_invalid) + type_information = infer_types(df, config={'engine': 'rule_based', 'pct_invalid': problem_definition.pct_invalid}) stats = statistical_analysis( df, type_information.dtypes, problem_definition.to_dict(), type_information.identifiers) diff --git a/lightwood/encoder/text/short.py b/lightwood/encoder/text/short.py index 127bb863f..3a3409af7 100644 --- a/lightwood/encoder/text/short.py +++ b/lightwood/encoder/text/short.py @@ -2,7 +2,7 @@ import torch from lightwood.encoder import BaseEncoder from lightwood.encoder.categorical import CategoricalAutoEncoder -from type_infer.helpers import tokenize_text +from type_infer.rule_based.helpers import tokenize_text from lightwood.helpers.torch import concat_vectors_and_pad, average_vectors import pandas as pd diff --git a/tests/unit_tests/encoder/text/test_short.py b/tests/unit_tests/encoder/text/test_short.py index 087ac4ac4..055e18b43 100644 --- a/tests/unit_tests/encoder/text/test_short.py +++ b/tests/unit_tests/encoder/text/test_short.py @@ -1,7 +1,7 @@ import random import unittest from lightwood.encoder.text.short import ShortTextEncoder -from type_infer.helpers import tokenize_text +from type_infer.rule_based.helpers import tokenize_text import torch VOCAB = [ From e4e5344de5ca1fa0c6fae2d2f15b7d53014e11a4 Mon Sep 17 00:00:00 2001 From: Patricio Cerda Mardini Date: Mon, 25 Dec 2023 20:24:49 +0900 Subject: [PATCH 2/2] version bump: 23.12.4.0 --- lightwood/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightwood/__about__.py b/lightwood/__about__.py index 8767aba7b..43a661b89 100644 --- a/lightwood/__about__.py +++ b/lightwood/__about__.py @@ -1,6 +1,6 @@ __title__ = 'lightwood' __package_name__ = 'lightwood' -__version__ = '23.12.2.0' +__version__ = '23.12.4.0' __description__ = "Lightwood is a toolkit for automatic machine learning model building" __email__ = "community@mindsdb.com" __author__ = 'MindsDB Inc'