mirror of
https://github.com/Doctorado-ML/bayesclass.git
synced 2025-08-15 23:55:57 +00:00
First functional with 100% coverage
This commit is contained in:
@@ -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]
|
||||
|
@@ -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()
|
@@ -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()
|
Reference in New Issue
Block a user