Initializing Core...
Initializing Core...
Operational
There are 3 main types of Machine Learning. Let’s keep it simple and understand them with examples.
You teach the model using labeled data. That means the data already contains the answers.
📌 Example:
A student learns from a textbook that has questions and answers.
🧪 Real-world Examples:
# Example: Predict marks based on study hoursfrom sklearn.linear_model import LinearRegressionX = [[2], [4], [6]]y = [50, 70, 90] # marksmodel = LinearRegression()model.fit(X, y)print(model.predict([[5]])) # Predict marks for 5 hours of study
The data has no labels. The model tries to find hidden patterns on its own.
📌 Example: A student reads a book in a language they don’t know, but tries to group similar words together.
🧪 Real-world Examples:
# Example: Group similar data pointsfrom sklearn.cluster import KMeansimport numpy as npX = np.array([[1, 2], [1, 4], [10, 2], [10, 4]])kmeans = KMeans(n_clusters=2).fit(X)print(kmeans.labels_)
Here, the model learns by trial and error. It gets rewards or penalties for the actions it takes.
📌 Example: Training a dog to sit by giving it a treat if it does it correctly.
🧪 Real-world Examples: