First functional with 100% coverage

This commit is contained in:
2022-11-05 20:00:18 +01:00
parent 3689852205
commit 8c03fc6b67
52 changed files with 94739 additions and 199 deletions

View File

@@ -3,19 +3,19 @@
Plotting Template Classifier
============================
An example plot of :class:`bayesclass.template.TemplateClassifier`
An example plot of :class:`bayesclass.TAN`
"""
import numpy as np
from matplotlib import pyplot as plt
from bayesclass import TemplateClassifier
from bayesclass import TAN
X = [[0, 0], [1, 1]]
y = [0, 1]
clf = TemplateClassifier()
clf = TAN()
clf.fit(X, y)
rng = np.random.RandomState(13)
X_test = rng.rand(500, 2)
X_test = rng.randint(2, size=(500, 2))
y_pred = clf.predict(X_test)
X_0 = X_test[y_pred == 0]

View File

@@ -1,17 +0,0 @@
"""
===========================
Plotting Template Estimator
===========================
An example plot of :class:`bayesclass.template.TemplateEstimator`
"""
import numpy as np
from matplotlib import pyplot as plt
from bayesclass import TemplateEstimator
X = np.arange(100).reshape(100, 1)
y = np.zeros((100,))
estimator = TemplateEstimator()
estimator.fit(X, y)
plt.plot(estimator.predict(X))
plt.show()

View File

@@ -1,26 +0,0 @@
"""
=============================
Plotting Template Transformer
=============================
An example plot of :class:`bayesclass.template.TemplateTransformer`
"""
import numpy as np
from matplotlib import pyplot as plt
from bayesclass import TemplateTransformer
X = np.arange(50, dtype=np.float).reshape(-1, 1)
X /= 50
estimator = TemplateTransformer()
X_transformed = estimator.fit_transform(X)
plt.plot(X.flatten(), label="Original Data")
plt.plot(X_transformed.flatten(), label="Transformed Data")
plt.title("Plots of original and transformed data")
plt.legend(loc="best")
plt.grid(True)
plt.xlabel("Index")
plt.ylabel("Value of Data")
plt.show()