diff --git a/autointent/_pipeline/_pipeline.py b/autointent/_pipeline/_pipeline.py index 02de7a6c..b639e071 100644 --- a/autointent/_pipeline/_pipeline.py +++ b/autointent/_pipeline/_pipeline.py @@ -12,8 +12,7 @@ from autointent import Context, Dataset from autointent.configs import EmbedderConfig, InferenceNodeConfig, LoggingConfig, VectorIndexConfig from autointent.custom_types import NodeType -from autointent.nodes import NodeOptimizer -from autointent.nodes.inference import InferenceNode +from autointent.nodes import InferenceNode, NodeOptimizer from autointent.utils import load_default_search_space, load_search_space from ._schemas import InferencePipelineOutput, InferencePipelineUtteranceOutput diff --git a/autointent/context/vector_index_client/_vector_index.py b/autointent/context/vector_index_client/_vector_index.py index 666b41b8..6760272c 100644 --- a/autointent/context/vector_index_client/_vector_index.py +++ b/autointent/context/vector_index_client/_vector_index.py @@ -172,7 +172,7 @@ def query( all_results = func(queries, k) # type: ignore[arg-type] all_labels = [[self.labels[result["id"]] for result in results] for results in all_results] - all_distances = [[result["distance"] for result in results] for results in all_results] + all_distances = [[float(result["distance"]) for result in results] for results in all_results] all_texts = [[self.texts[result["id"]] for result in results] for results in all_results] return all_labels, all_distances, all_texts diff --git a/autointent/custom_types.py b/autointent/custom_types.py index ac2b36aa..d7388586 100644 --- a/autointent/custom_types.py +++ b/autointent/custom_types.py @@ -21,7 +21,8 @@ class LogLevel(Enum): # Literal type for weight types in specific operations WEIGHT_TYPES = Literal["uniform", "distance", "closest"] """ -Represents weight calculation methods: +Represents weight calculation methods + - "uniform": Equal weight for all elements. - "distance": Weights based on distance. - "closest": Prioritizes closest elements. @@ -30,7 +31,8 @@ class LogLevel(Enum): # Type alias for label representation LabelType = int | list[int] """ -Type alias for label representation: +Type alias for label representation + - `int`: For single-label classification. - `list[int]`: For multi-label classification. """ diff --git a/autointent/modules/prediction/_adaptive.py b/autointent/modules/prediction/_adaptive.py index 311f5e50..3eba03b1 100644 --- a/autointent/modules/prediction/_adaptive.py +++ b/autointent/modules/prediction/_adaptive.py @@ -47,26 +47,22 @@ class AdaptivePredictor(PredictionModule): Examples -------- - >>> from autointent.modules import AdaptivePredictor - >>> import numpy as np - >>> scores = np.array([[0.8, 0.1, 0.4], [0.2, 0.9, 0.5]]) - >>> labels = [[1, 0, 0], [0, 1, 0]] - >>> search_space = [0.1, 0.2, 0.3, 0.5, 0.7] - >>> predictor = AdaptivePredictor(search_space=search_space) - >>> predictor.fit(scores, labels) - >>> predictions = predictor.predict(scores) - >>> print(predictions) - [[1 0 0] - [0 1 0]] - - Save and load the predictor: - >>> predictor.dump("outputs/") - >>> predictor_loaded = AdaptivePredictor() - >>> predictor_loaded.load("outputs/") - >>> predictions = predictor_loaded.predict(scores) - >>> print(predictions) - [[1 0 0] - [0 1 0]] + .. testcode:: + + from autointent.modules.prediction import AdaptivePredictor + import numpy as np + scores = np.array([[0.8, 0.1, 0.4], [0.2, 0.9, 0.5]]) + labels = [[1, 0, 0], [0, 1, 0]] + predictor = AdaptivePredictor() + predictor.fit(scores, labels) + predictions = predictor.predict(scores) + print(predictions) + + .. testoutput:: + + [[1 0 0] + [0 1 0]] + """ metadata_dict_name = "metadata.json" diff --git a/autointent/modules/prediction/_argmax.py b/autointent/modules/prediction/_argmax.py index 69cdca47..ddabb9fe 100644 --- a/autointent/modules/prediction/_argmax.py +++ b/autointent/modules/prediction/_argmax.py @@ -32,24 +32,22 @@ class ArgmaxPredictor(PredictionModule): Examples -------- - >>> from autointent.modules import ArgmaxPredictor - >>> import numpy as np - >>> predictor = ArgmaxPredictor() - >>> train_scores = np.array([[0.2, 0.8, 0.0], [0.7, 0.1, 0.2]]) - >>> labels = [1, 0] # Single-label targets - >>> predictor.fit(train_scores, labels) - >>> test_scores = np.array([[0.1, 0.5, 0.4], [0.6, 0.3, 0.1]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [1 0] - - Save the predictor's state: - >>> predictor.dump("outputs/") - >>> loaded_predictor = ArgmaxPredictor() - >>> loaded_predictor.load("outputs/") - >>> loaded_predictions = loaded_predictor.predict(test_scores) - >>> print(loaded_predictions) - [1 0] + .. testcode:: + + from autointent.modules import ArgmaxPredictor + import numpy as np + predictor = ArgmaxPredictor() + train_scores = np.array([[0.2, 0.8, 0.0], [0.7, 0.1, 0.2]]) + labels = [1, 0] # Single-label targets + predictor.fit(train_scores, labels) + test_scores = np.array([[0.1, 0.5, 0.4], [0.6, 0.3, 0.1]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [1 0] + """ name = "argmax" diff --git a/autointent/modules/prediction/_jinoos.py b/autointent/modules/prediction/_jinoos.py index 6c7e054a..6ce96b9c 100644 --- a/autointent/modules/prediction/_jinoos.py +++ b/autointent/modules/prediction/_jinoos.py @@ -37,24 +37,23 @@ class JinoosPredictor(PredictionModule): Examples -------- - >>> from autointent.modules import JinoosPredictor - >>> import numpy as np - >>> scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) - >>> labels = [1, 0, 1] - >>> search_space = [0.3, 0.5, 0.7] - >>> predictor = JinoosPredictor(search_space=search_space) - >>> predictor.fit(scores, labels) - >>> test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [1 0] - - Save and load the predictor state: - >>> predictor.dump("outputs/") - >>> loaded_predictor = JinoosPredictor() - >>> loaded_predictor.load("outputs/") - >>> print(loaded_predictor.thresh) - 0.5 # Example threshold from the search space + .. testcode:: + + from autointent.modules import JinoosPredictor + import numpy as np + scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) + labels = [1, 0, 1] + search_space = [0.3, 0.5, 0.7] + predictor = JinoosPredictor(search_space=search_space) + predictor.fit(scores, labels) + test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [1 0] + """ thresh: float diff --git a/autointent/modules/prediction/_threshold.py b/autointent/modules/prediction/_threshold.py index 58f9bafa..226cd232 100644 --- a/autointent/modules/prediction/_threshold.py +++ b/autointent/modules/prediction/_threshold.py @@ -42,34 +42,41 @@ class ThresholdPredictor(PredictionModule): Examples -------- - Single-label classification example: - >>> from autointent.modules import ThresholdPredictor - >>> import numpy as np - >>> scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) - >>> labels = [1, 0, 1] - >>> threshold = 0.5 - >>> predictor = ThresholdPredictor(thresh=threshold) - >>> predictor.fit(scores, labels) - >>> test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [1 0] - - Multi-label classification example: - >>> labels = [[1, 0], [0, 1], [1, 1]] - >>> predictor = ThresholdPredictor(thresh=[0.5, 0.5]) - >>> predictor.fit(scores, labels) - >>> test_scores = np.array([[0.3, 0.7], [0.6, 0.4]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [[0 1] [1 0]] - - Save and load the model: - >>> predictor.dump("outputs/") - >>> loaded_predictor = ThresholdPredictor(thresh=0.5) - >>> loaded_predictor.load("outputs/") - >>> print(loaded_predictor.thresh) - 0.5 + Single-label classification + =========================== + .. testcode:: + + from autointent.modules import ThresholdPredictor + import numpy as np + scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) + labels = [1, 0, 1] + threshold = 0.5 + predictor = ThresholdPredictor(thresh=threshold) + predictor.fit(scores, labels) + test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [1 0] + + Multi-label classification + ========================== + .. testcode:: + + labels = [[1, 0], [0, 1], [1, 1]] + predictor = ThresholdPredictor(thresh=[0.5, 0.5]) + predictor.fit(scores, labels) + test_scores = np.array([[0.3, 0.7], [0.6, 0.4]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [[0 1] + [1 0]] + """ metadata: ThresholdPredictorDumpMetadata diff --git a/autointent/modules/prediction/_tunable.py b/autointent/modules/prediction/_tunable.py index aab0c39b..2c7d6300 100644 --- a/autointent/modules/prediction/_tunable.py +++ b/autointent/modules/prediction/_tunable.py @@ -43,33 +43,40 @@ class TunablePredictor(PredictionModule): Examples -------- - Single-label classification: - >>> import numpy as np - >>> from autointent.modules import TunablePredictor - >>> scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) - >>> labels = [1, 0, 1] - >>> predictor = TunablePredictor(n_trials=100, seed=42) - >>> predictor.fit(scores, labels) - >>> test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [1 0] - - Multi-label classification: - >>> labels = [[1, 0], [0, 1], [1, 1]] - >>> predictor = TunablePredictor(n_trials=100, seed=42) - >>> predictor.fit(scores, labels) - >>> test_scores = np.array([[0.3, 0.7], [0.6, 0.4]]) - >>> predictions = predictor.predict(test_scores) - >>> print(predictions) - [[0 1] [1 0]] - - Saving and loading the model: - >>> predictor.dump("outputs/") - >>> loaded_predictor = TunablePredictor() - >>> loaded_predictor.load("outputs/") - >>> print(loaded_predictor.thresh) - [0.5, 0.7] + Single-label classification + =========================== + .. testcode:: + + import numpy as np + from autointent.modules import TunablePredictor + scores = np.array([[0.2, 0.8], [0.6, 0.4], [0.1, 0.9]]) + labels = [1, 0, 1] + predictor = TunablePredictor(n_trials=100, seed=42) + predictor.fit(scores, labels) + test_scores = np.array([[0.3, 0.7], [0.5, 0.5]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [1 0] + + Multi-label classification + ========================== + .. testcode:: + + labels = [[1, 0], [0, 1], [1, 1]] + predictor = TunablePredictor(n_trials=100, seed=42) + predictor.fit(scores, labels) + test_scores = np.array([[0.3, 0.7], [0.6, 0.4]]) + predictions = predictor.predict(test_scores) + print(predictions) + + .. testoutput:: + + [[1 1] + [1 1]] + """ name = "tunable" diff --git a/autointent/modules/retrieval/_vectordb.py b/autointent/modules/retrieval/_vectordb.py index abf78d37..4f6c4238 100644 --- a/autointent/modules/retrieval/_vectordb.py +++ b/autointent/modules/retrieval/_vectordb.py @@ -32,28 +32,33 @@ class VectorDBModule(RetrievalModule): Examples -------- - Creating and fitting the VectorDBModule: - >>> from your_module import VectorDBModule - >>> utterances = ["hello world", "how are you?", "good morning"] - >>> labels = [1, 2, 3] - >>> vector_db = VectorDBModule(k=2, embedder_name="some_embedder", db_dir="./db", device="cpu") - >>> vector_db.fit(utterances, labels) - >>> def retrieval_metric_fn(true_labels, predicted_labels): - >>> # Custom metric function (e.g., accuracy or F1 score) - >>> return sum([1 if true == pred else 0 for true, pred \\ - >>> in zip(true_labels, predicted_labels)]) / len(true_labels) - >>> score = vector_db.score(context, retrieval_metric_fn) - >>> print(score) - - Performing predictions: - >>> predictions = vector_db.predict(["how is the weather today?"]) - >>> print(predictions) - - Saving and loading the model: - >>> vector_db.dump("outputs/") - >>> loaded_vector_db = VectorDBModule(k=2, embedder_name="some_embedder", db_dir="./db", device="cpu") - >>> loaded_vector_db.load("outputs/") - >>> print(loaded_vector_db.vector_index) + .. testsetup:: + + db_dir = "doctests-db" + + .. testcode:: + + from autointent.modules.retrieval import VectorDBModule + utterances = ["bye", "how are you?", "good morning"] + labels = [0, 1, 1] + vector_db = VectorDBModule( + k=2, + embedder_name="sergeyzh/rubert-tiny-turbo", + db_dir=db_dir, + ) + vector_db.fit(utterances, labels) + predictions = vector_db.predict(["how is the weather today?"]) + print(predictions) + + .. testoutput:: + + ([[1, 1]], [[0.1525942087173462, 0.18616724014282227]], [['good morning', 'how are you?']]) + + .. testcleanup:: + + import shutil + shutil.rmtree(db_dir) + """ vector_index: VectorIndex diff --git a/autointent/modules/scoring/_description/description.py b/autointent/modules/scoring/_description/description.py index 86a9797d..b982e893 100644 --- a/autointent/modules/scoring/_description/description.py +++ b/autointent/modules/scoring/_description/description.py @@ -40,24 +40,6 @@ class DescriptionScorer(ScoringModule): :ivar db_dir: Directory path where the vector database is stored. :ivar name: Name of the scorer, defaults to "description". - Examples - -------- - Creating and fitting the DescriptionScorer - >>> from autointent.modules import DescriptionScorer - >>> utterances = ["what is your name?", "how old are you?"] - >>> labels = [0, 1] - >>> descriptions = ["greeting", "age-related question"] - >>> scorer = DescriptionScorer(embedder_name="your_embedder", temperature=1.0) - >>> scorer.fit(utterances, labels, descriptions) - - Predicting scores: - >>> scores = scorer.predict(["tell me about your age?"]) - >>> print(scores) # Outputs similarity scores for the utterance against all descriptions - - Saving and loading the scorer: - >>> scorer.dump("outputs/") - >>> loaded_scorer = DescriptionScorer(embedder_name="your_embedder") - >>> loaded_scorer.load("outputs/") """ weights_file_name: str = "description_vectors.npy" diff --git a/autointent/modules/scoring/_dnnc/dnnc.py b/autointent/modules/scoring/_dnnc/dnnc.py index 1c86eaad..0febd8d6 100644 --- a/autointent/modules/scoring/_dnnc/dnnc.py +++ b/autointent/modules/scoring/_dnnc/dnnc.py @@ -57,37 +57,38 @@ class DNNCScorer(ScoringModule): Examples -------- - Creating and fitting the DNNCScorer: - >>> from autointent.modules import DNNCScorer - >>> utterances = ["what is your name?", "how are you?"] - >>> labels = ["greeting", "greeting"] - >>> scorer = DNNCScorer( - >>> cross_encoder_name="cross_encoder_model", - >>> embedder_name="embedder_model", - >>> k=5, - >>> db_dir="/path/to/database", - >>> device="cuda", - >>> train_head=True, - >>> batch_size=32, - >>> max_length=128 - >>> ) - >>> scorer.fit(utterances, labels) - - Predicting scores: - >>> test_utterances = ["Hello!", "What's up?"] - >>> scores = scorer.predict(test_utterances) - >>> print(scores) # Outputs similarity scores for the utterances - - Saving and loading the scorer: - >>> scorer.dump("outputs/") - >>> loaded_scorer = DNNCScorer( - >>> cross_encoder_name="cross_encoder_model", - >>> embedder_name="embedder_model", - >>> k=5, - >>> db_dir="/path/to/database", - >>> device="cuda" - >>> ) - >>> loaded_scorer.load("outputs/") + .. testsetup:: + + db_dir = "doctests-db" + + .. testcode:: + + from autointent.modules.scoring import DNNCScorer + utterances = ["what is your name?", "how are you?"] + labels = [0, 1] + scorer = DNNCScorer( + cross_encoder_name="cross-encoder/ms-marco-MiniLM-L-6-v2", + embedder_name="sergeyzh/rubert-tiny-turbo", + k=5, + db_dir=db_dir, + ) + scorer.fit(utterances, labels) + + test_utterances = ["Hello!", "What's up?"] + scores = scorer.predict(test_utterances) + print(scores) # Outputs similarity scores for the utterances + + + .. testoutput:: + + [[-8.90408421 0. ] + [-8.10923195 0. ]] + + .. testcleanup:: + + import shutil + shutil.rmtree(db_dir) + """ name = "dnnc" diff --git a/autointent/modules/scoring/_knn/knn.py b/autointent/modules/scoring/_knn/knn.py index 938a0da2..24250754 100644 --- a/autointent/modules/scoring/_knn/knn.py +++ b/autointent/modules/scoring/_knn/knn.py @@ -47,36 +47,35 @@ class KNNScorer(ScoringModule): Examples -------- - Creating and fitting the KNNScorer: - >>> from autointent.modules import KNNScorer - >>> utterances = ["hello", "how are you?"] - >>> labels = ["greeting", "greeting"] - >>> scorer = KNNScorer( - >>> embedder_name="bert-base", - >>> k=5, - >>> weights="distance", - >>> db_dir="/path/to/database", - >>> device="cuda", - >>> batch_size=32, - >>> max_length=128 - >>> ) - >>> scorer.fit(utterances, labels) - - Predicting class probabilities: - >>> test_utterances = ["hi", "what's up?"] - >>> probabilities = scorer.predict(test_utterances) - >>> print(probabilities) # Outputs predicted class probabilities for the utterances - - Saving and loading the scorer: - >>> scorer.dump("outputs/") - >>> loaded_scorer = KNNScorer( - >>> embedder_name="bert-base", - >>> k=5, - >>> weights="distance", - >>> db_dir="/path/to/database", - >>> device="cuda" - >>> ) - >>> loaded_scorer.load("outputs/") + .. testsetup:: + + db_dir = "doctests-db" + + .. testcode:: + + from autointent.modules.scoring import KNNScorer + utterances = ["hello", "how are you?"] + labels = [0, 1] + scorer = KNNScorer( + embedder_name="sergeyzh/rubert-tiny-turbo", + k=5, + db_dir=db_dir, + ) + scorer.fit(utterances, labels) + test_utterances = ["hi", "what's up?"] + probabilities = scorer.predict(test_utterances) + print(probabilities) # Outputs predicted class probabilities for the utterances + + .. testoutput:: + + [[0.67297815 0.32702185] + [0.44031678 0.55968322]] + + .. testcleanup:: + + import shutil + shutil.rmtree(db_dir) + """ weights: WEIGHT_TYPES @@ -89,7 +88,7 @@ def __init__( self, embedder_name: str, k: int, - weights: WEIGHT_TYPES, + weights: WEIGHT_TYPES = "distance", db_dir: str | None = None, device: str = "cpu", batch_size: int = 32, diff --git a/autointent/modules/scoring/_linear.py b/autointent/modules/scoring/_linear.py index cdd32e40..6c7615bd 100644 --- a/autointent/modules/scoring/_linear.py +++ b/autointent/modules/scoring/_linear.py @@ -45,33 +45,24 @@ class LinearScorer(ScoringModule): Example -------- - Creating and fitting the LinearScorer: - >>> from autointent.modules import LinearScorer - >>> utterances = ["what is your name?", "how are you?"] - >>> labels = ["greeting", "greeting"] - >>> scorer = LinearScorer( - >>> embedder_name="bert-base", - >>> cv=3, - >>> n_jobs=-1, - >>> device="cuda", - >>> seed=42, - >>> batch_size=32, - >>> max_length=128 - >>> ) - >>> scorer.fit(utterances, labels) - - Predicting probabilities: - >>> test_utterances = ["Hello!", "What's up?"] - >>> probabilities = scorer.predict(test_utterances) - >>> print(probabilities) # Outputs predicted probabilities for each class - - Saving and loading the scorer: - >>> scorer.dump("outputs/") - >>> loaded_scorer = LinearScorer( - >>> embedder_name="bert-base", - >>> device="cuda" - >>> ) - >>> loaded_scorer.load("outputs/") + .. testcode:: + + from autointent.modules import LinearScorer + scorer = LinearScorer( + embedder_name="sergeyzh/rubert-tiny-turbo", cv=2 + ) + utterances = ["hello", "goodbye", "allo", "sayonara"] + labels = [0, 1, 0, 1] + scorer.fit(utterances, labels) + test_utterances = ["hi", "bye"] + probabilities = scorer.predict(test_utterances) + print(probabilities) + + .. testoutput:: + + [[0.50000032 0.49999968] + [0.50000032 0.49999968]] + """ classifier_file_name: str = "classifier.joblib" @@ -84,7 +75,7 @@ def __init__( self, embedder_name: str, cv: int = 3, - n_jobs: int = -1, + n_jobs: int | None = None, device: str = "cpu", seed: int = 0, batch_size: int = 32, diff --git a/autointent/modules/scoring/_mlknn/mlknn.py b/autointent/modules/scoring/_mlknn/mlknn.py index 9b48b66f..f15d2c81 100644 --- a/autointent/modules/scoring/_mlknn/mlknn.py +++ b/autointent/modules/scoring/_mlknn/mlknn.py @@ -59,40 +59,35 @@ class MLKnnScorer(ScoringModule): Example -------- - Creating and fitting the MLKnnScorer: - >>> from knn_scorer import MLKnnScorer - >>> utterances = ["what is your name?", "how are you?"] - >>> labels = [["greeting"], ["greeting"]] - >>> scorer = MLKnnScorer( - >>> k=5, - >>> embedder_name="bert-base", - >>> db_dir="/path/to/database", - >>> s=1.0, - >>> ignore_first_neighbours=0, - >>> device="cuda", - >>> batch_size=32, - >>> max_length=128 - >>> ) - >>> scorer.fit(utterances, labels) - - Predicting probabilities: - >>> test_utterances = ["Hi!", "What's up?"] - >>> probabilities = scorer.predict(test_utterances) - >>> print(probabilities) # Outputs predicted probabilities for each label - - Predicting labels: - >>> predicted_labels = scorer.predict_labels(test_utterances, thresh=0.5) - >>> print(predicted_labels) # Outputs binary array for each label prediction - - Saving and loading the scorer: - >>> scorer.dump("outputs/") - >>> loaded_scorer = MLKnnScorer( - >>> k=5, - >>> embedder_name="bert-base", - >>> db_dir="/path/to/database", - >>> device="cuda" - >>> ) - >>> loaded_scorer.load("outputs/") + .. testsetup:: + + db_dir = "doctests-db" + + .. testcode:: + + from autointent.modules.scoring import MLKnnScorer + utterances = ["what is your name?", "how are you?"] + labels = [[1,0], [0,1]] + scorer = MLKnnScorer( + k=5, + embedder_name="sergeyzh/rubert-tiny-turbo", + db_dir=db_dir, + ) + scorer.fit(utterances, labels) + test_utterances = ["Hi!", "What's up?"] + probabilities = scorer.predict(test_utterances) + print(probabilities) # Outputs predicted probabilities for each label + + .. testoutput:: + + [[0.5 0.5] + [0.5 0.5]] + + .. testcleanup:: + + import shutil + shutil.rmtree(db_dir) + """ arrays_filename: str = "probs.npz" diff --git a/autointent/nodes/__init__.py b/autointent/nodes/__init__.py index 385f00fd..7e327e4e 100644 --- a/autointent/nodes/__init__.py +++ b/autointent/nodes/__init__.py @@ -1,4 +1,4 @@ -from .inference import InferenceNode +from ._inference_node import InferenceNode from .nodes_info import NodeInfo, PredictionNodeInfo, RegExpNodeInfo, RetrievalNodeInfo, ScoringNodeInfo from .optimization import NodeOptimizer diff --git a/autointent/nodes/inference/_inference_node.py b/autointent/nodes/_inference_node.py similarity index 100% rename from autointent/nodes/inference/_inference_node.py rename to autointent/nodes/_inference_node.py diff --git a/autointent/nodes/inference/__init__.py b/autointent/nodes/inference/__init__.py deleted file mode 100644 index 3dcf1487..00000000 --- a/autointent/nodes/inference/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from ._inference_node import InferenceNode - -__all__ = ["InferenceNode"] diff --git a/docs/source/conf.py b/docs/source/conf.py index b3e7bc31..779e2350 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -51,12 +51,11 @@ # API reference -nitpicky = True # warn about unknown links +# nitpicky = True # warn about unknown links intersphinx_mapping = { "python": ("https://docs.python.org/3", None), - "pathlib": ("https://docs.python.org/3/library/pathlib.html", None), - # Add other mappings as needed + "pydantic": ("https://docs.pydantic.dev/latest/", None), } autoapi_keep_files = True diff --git a/docs/source/guides/search_space_configuration.rst b/docs/source/guides/search_space_configuration.rst index d18e2ddc..75128503 100644 --- a/docs/source/guides/search_space_configuration.rst +++ b/docs/source/guides/search_space_configuration.rst @@ -26,7 +26,11 @@ To set up the optimization module, you need to create the following dictionary: ] } -The ``module_type`` field specifies the name of the module. You can find the names, for example, in :py:data:`autointent.modules.SCORING_MODULES_MULTICLASS`. +The ``module_type`` field specifies the name of the module. You can find the names, for example, in... + +.. todo:: + + Add docs for all available modules. All fields except ``module_type`` are lists that define the search space for each hyperparameter. If you omit them, the default set of hyperparameters will be used during auto-configuration: