Machine learning algorithms are generally categorized into three main types
Machine learning algorithms are generally categorized into three main types
python
CopyEdit
import numpy as np
import pandas as pd
# Sample Data
data = [10, 15, 12, 18, 15, 21, 25, 10, 30, 15]
# Mean
mean_value = np.mean(data)
print("Mean:", mean_value)
# Median
median_value = np.median(data)
print("Median:", median_value)
# Mode
print("Mode:", mode_value.mode[0])
python
CopyEdit
# Variance
print("Variance:", variance_value)
# Standard Deviation
# Range
print("Range:", range_value)
q1 = np.percentile(data, 25)
q3 = np.percentile(data, 75)
iqr_value = q3 - q1
print("IQR:", iqr_value)
python
CopyEdit
plt.show()
Binomial Distribution
python
CopyEdit
n, p = 10, 0.5
# Plot histogram
plt.title("Binomial Distribution")
plt.show()
python
CopyEdit
# Perform t-test
print("P-Value:", p_value)
python
CopyEdit
# Contingency Table
print("P-Value:", p)
python
CopyEdit
x = np.random.rand(10)
y = np.random.rand(10)
# Correlation Coefficient
# Covariance
print("Covariance:", covariance)
Mutual Information
python
CopyEdit
# Example dataset
mi_score = mutual_info_classif(X, y)
python
CopyEdit
# Sample Data
y = np.array([0, 1, 0, 1, 0, 1])
clf = DecisionTreeClassifier(criterion='entropy')
clf.fit(X, y)
feature_importance = clf.feature_importances_
Machine learning algorithms are generally categorized into three main types:
Linear Regression
Polynomial Regression
Logistic Regression
Decision Tree
Random Forest
Naïve Bayes
Neural Networks
naive_bayes = GaussianNB(var_smoothing=1e-9)
In unsupervised learning, the algorithm is trained on unlabeled data and tries to find hidden
patterns.
K-Means
Hierarchical Clustering