
DEEP LEARNING LAB INTERNAL PROGRAMS
=================================

----------------------------------------
1. ICE CREAM SALES PREDICTOR
----------------------------------------
Analogy: Temperature ↑ → Ice cream sales ↑

import numpy as np
from sklearn.linear_model import LinearRegression

temperature = np.array([[20], [25], [30], [35], [40]])
sales = np.array([200, 300, 400, 500, 600])

model = LinearRegression()
model.fit(temperature, sales)

print(model.predict([[33]]))


----------------------------------------
2. STUDY HOURS TO MARKS PREDICTOR
----------------------------------------
Analogy: More practice = better score

import numpy as np
from sklearn.linear_model import LinearRegression

hours = np.array([[1], [2], [3], [4], [5]])
marks = np.array([35, 45, 55, 65, 75])

model = LinearRegression()
model.fit(hours, marks)

print(model.predict([[6]]))


----------------------------------------
3. HOUSE PRICE ESTIMATOR
----------------------------------------
Analogy: Price depends on size + rooms

import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([[800,2], [1000,3], [1200,3], [1500,4]])
price = np.array([40, 50, 60, 80])

model = LinearRegression()
model.fit(X, price)

print(model.predict([[1300,3]]))


----------------------------------------
4. FUEL CONSUMPTION ESTIMATOR
----------------------------------------
Analogy: Weight + speed affect mileage

import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([[1000,60], [1200,55], [1400,50], [1600,45]])
mileage = np.array([20, 18, 16, 14])

model = LinearRegression()
model.fit(X, mileage)

print(model.predict([[1300,52]]))


----------------------------------------
5. CROP YIELD PREDICTOR
----------------------------------------
Analogy: Rainfall + fertilizer affect yield

import numpy as np
from sklearn.linear_model import LinearRegression

X = np.array([[100,20], [120,25], [140,30], [160,35]])
yield_ = np.array([30, 40, 50, 60])

model = LinearRegression()
model.fit(X, yield_)

print(model.predict([[150,32]]))


----------------------------------------
6. VIRTUAL CLASSROOM NOTE TAKER
----------------------------------------
Analogy: Like a student writing notes while teacher speaks

import speech_recognition as sr

r = sr.Recognizer()

with sr.Microphone() as source:
    print("Speak now...")
    audio = r.listen(source)

text = r.recognize_google(audio)
print(text)

with open("lecture_notes.txt", "w") as f:
    f.write(text)


----------------------------------------
7. PROGRAM TO CONVERT TEXT INTO SPEECH
----------------------------------------

import pyttsx3

engine = pyttsx3.init()
engine.say("This is text to speech conversion")
engine.runAndWait()


----------------------------------------
8. PROGRAM TO CONVERT VIDEO INTO FRAMES
----------------------------------------

import cv2

video = cv2.VideoCapture("video.mp4")
count = 0

while True:
    success, frame = video.read()
    if not success:
        break
    cv2.imwrite(f"frame{count}.jpg", frame)
    count += 1

video.release()


----------------------------------------
9. TIME SERIES FORECASTING USING LSTM
----------------------------------------

import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense

data = np.array([10,20,30,40,50,60,70])

X, y = [], []
for i in range(len(data)-1):
    X.append(data[i])
    y.append(data[i+1])

X = np.array(X).reshape(-1,1,1)
y = np.array(y)

model = Sequential()
model.add(LSTM(10, input_shape=(1,1)))
model.add(Dense(1))

model.compile(optimizer='adam', loss='mse')
model.fit(X, y, epochs=200, verbose=0)

print(model.predict(np.array([70]).reshape(1,1,1)))
