Hey @fiery herald!
Please edit your message to use a code block
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
6 messages ยท Page 1 of 1 (latest)
Hey @fiery herald!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
@fiery herald
Remember to:
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
df = pd.read_csv(r'used_car_price_dataset_extended.csv')
df['color'] = df['color'].map({'Gray': 0, 'Black': 1, 'Red': 2, 'White': 3, 'Blue': 4, 'Silver': 5})
df['service_history'] = df['service_history'].map({'Partial': 2, 'Full': 1})
df['service_history'] = df['service_history'].fillna(0)
df['fuel_type'] = df['fuel_type'].map({'Petrol': 0, 'Diesel': 1, 'Electric': 2})
df['brand'] = df['brand'].map({'Nissan': 0, 'Volkswagen': 1, 'BMW': 2, 'Tesla': 3, 'Honda': 4, 'Chevrolet': 5, 'Hyundai': 6, 'Toyota': 7, 'Kia': 8, 'Ford': 9})
df['transmission'] = df['transmission'].map({'Manual': 0, 'Automatic': 1})
df['insurance_valid'] = df['insurance_valid'].map({'Yes': 1, 'No': 0})
year_bins = [1990, 2005, 2010, 2015, 2020, 2025]
year_labels = [0, 1, 2, 3, 4]
df['make_year'] = pd.cut(df['make_year'], bins=year_bins, labels=year_labels, right=False)
engine_bins = [500, 1000, 1500, 2500, 4000, 5001]
engine_labels = [0, 1, 2, 3, 4]
df['engine_cc'] = pd.cut(df['engine_cc'], bins=engine_bins, labels=engine_labels, right=False)
mileage_bins = [0, 10, 15, 20, 25, 30, 40]
mileage_labels = [0, 1, 2, 3, 4, 5]
df['mileage_kmpl'] = pd.cut(df['mileage_kmpl'], bins=mileage_bins, labels=mileage_labels, right=False)
price_bins = [0, 5000, 10000, 15000, 20000, float('inf')]
price_labels = [0, 1, 2, 3, 4] # Cheap โ Expensive
df['price_usd'] = pd.cut(df['price_usd'], bins=price_bins, labels=price_labels)
x = df.drop(columns=['price_usd'])
y = df['price_usd']
X_train, X_test, y_train, y_test = train_test_split(
x, y, test_size=0.2, random_state=22
)
model = LogisticRegression(max_iter=100000)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
from sklearn.metrics import accuracy_score
print("Accuracy:", accuracy_score(y_test, y_pred))
print(df.head())
the max Accuracy i got with this is 0.7 how to increase it
@fiery herald
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.