Example output
1. Import the necessary packages
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
2. Load the dataset
df = pd.read_csv('tweets_api_data.csv')
3. Split the dataset
X = df.drop(['classification'], axis=1)
y = df['classification']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
4. Preprocess the data
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
5. Train the model
model = LogisticRegression()
model.fit(X_train, y_train)
6. Test the model
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
7. Evaluate the model
print('Model accuracy is: ', accuracy)