Ejemplo n.º 1
0
# Sebastian Raschka 2014-2018
# mlxtend Machine Learning Library Extensions
# Author: Sebastian Raschka <sebastianraschka.com>
#
# License: BSD 3 clause

from mlxtend.data import three_blobs_data
from mlxtend.cluster import Kmeans
from mlxtend.utils import assert_raises
import numpy as np


X, y = three_blobs_data()


def test_nonfitted():
    km = Kmeans(k=3,
                max_iter=50,
                random_seed=1,
                print_progress=0)

    km._is_fitted = False
    assert_raises(AttributeError,
                  'Model is not fitted, yet.',
                  km.predict,
                  X)


def test_three_blobs_multi():
    km = Kmeans(k=3,
                max_iter=50,
Ejemplo n.º 2
0
def test_import_three_blobs_data():
    X, y = three_blobs_data()
    assert (X.shape[0] == 150), X.shape
    assert (X.shape[1] == 2)
    assert (y.shape[0] == 150)
Ejemplo n.º 3
0
def test_import_three_blobs_data():
    X, y = three_blobs_data()
    assert(X.shape[0] == 150), X.shape
    assert(X.shape[1] == 2)
    assert(y.shape[0] == 150)