ndarray Module¶
This section documents the NumPy ndarray utilities of the nextmv-scikit-learn package.
ndarray
¶
NumPy ndarray wrapper for Pydantic model integration.
This module provides utilities to handle NumPy arrays in Pydantic models.
Variables
ndarray : Annotated A type annotation for NumPy arrays in Pydantic models.
ndarray
module-attribute
¶
ndarray: An annotated type that represents a NumPy array.
You can import the ndarray type directly from nextmv_sklearn:
This type is designed for use with Pydantic models to properly handle NumPy arrays for validation and serialization.
The BeforeValidator ensures the input is preserved as is, while PlainSerializer converts the ndarray to a Python list when serializing.
Examples:
>>> from pydantic import BaseModel
>>> from nextmv_sklearn import ndarray
>>> import numpy as np
>>>
>>> class MyModel(BaseModel):
... data: ndarray
...
>>> model = MyModel(data=np.array([1, 2, 3]))
>>> model.model_dump_json()
'{"data":[1,2,3]}'
Returned by:
-
Tree Models
solutionDecisionTreeRegressorSolutionfeature_names_in_ -
nextmv-scikit-learn
โ๏ธ Reference
-
ensemble
Solution
solution -
linear_model
Solution
solutionLinearRegressionSolution -
neural_network
Solution
solutionMLPRegressorSolution -
tree
Solution
solutionDecisionTreeRegressorSolutionfeature_names_in_
-
ensemble
Solution
-
Tree Models
solutionDecisionTreeRegressorSolution -
nextmv-scikit-learn
โ๏ธ Reference
-
ensemble
Solution
solution -
linear_model
Solution
solutionLinearRegressionSolution -
neural_network
Solution
solutionMLPRegressorSolution -
tree
Solution
solutionDecisionTreeRegressorSolution
-
ensemble
Solution