예제 #1
0
파일: test_base.py 프로젝트: st071300/cuML
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import inspect

import cuml
import pytest
import numpydoc.docscrape
from cuml.test.utils import (get_classes_from_package,
                             small_classification_dataset)

all_base_children = get_classes_from_package(cuml, import_sub_packages=True)


def test_base_class_usage():
    # Ensure base class returns the 3 main properties needed by all classes
    base = cuml.Base()
    base.handle.sync()
    base_params = base.get_param_names()

    assert "handle" in base_params
    assert "verbose" in base_params
    assert "output_type" in base_params

    del base

예제 #2
0
umap_model = {"UMAP": cuml.UMAP}

rf_module = ClassEnumerator(module=cuml.ensemble)
rf_models = rf_module.get_models()

k_neighbors_config = ClassEnumerator(
    module=cuml.neighbors, exclude_classes=[cuml.neighbors.NearestNeighbors])
k_neighbors_models = k_neighbors_config.get_models()

unfit_pickle_xfail = ['ARIMA', 'KalmanFilter', 'ForestInference']
unfit_clone_xfail = [
    'ARIMA', 'ExponentialSmoothing', 'KalmanFilter', 'MBSGDClassifier',
    'MBSGDRegressor'
]

all_models = get_classes_from_package(cuml)
all_models.update({
    **regression_models,
    **solver_models,
    **cluster_models,
    **decomposition_models,
    **decomposition_models_xfail,
    **neighbor_models,
    **dbscan_model,
    **umap_model,
    **rf_models,
    **k_neighbors_models,
    'ARIMA':
    lambda: ARIMA((1, 1, 1), np.array([-217.72, -206.77]), [
        np.array([0.03]), np.array([-0.03])
    ], [np.array([-0.99]), np.array([-0.99])],
예제 #3
0
    'ARIMA', 'AutoARIMA', 'KalmanFilter', 'BaseRandomForestModel',
    'ForestInference', 'MulticlassClassifier', 'OneVsOneClassifier',
    'OneVsRestClassifier'
]
unfit_clone_xfail = [
    'AutoARIMA',
    "ARIMA",
    "BaseRandomForestModel",
    "GaussianRandomProjection",
    'MulticlassClassifier',
    'OneVsOneClassifier',
    'OneVsRestClassifier',
    "SparseRandomProjection",
]

all_models = get_classes_from_package(cuml, import_sub_packages=True)
all_models.update({
    **regression_models,
    **solver_models,
    **cluster_models,
    **decomposition_models,
    **decomposition_models_xfail,
    **neighbor_models,
    **dbscan_model,
    **agglomerative_model,
    **umap_model,
    **rf_models,
    **k_neighbors_models,
    'ARIMA':
    lambda: ARIMA(np.random.normal(0.0, 1.0, (10, ))),
    'ExponentialSmoothing':