-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
import numpy as np | ||
import numpy as np | ||
from numpy import genfromtxt | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.preprocessing import StandardScaler | ||
|
||
class AccuracyDataLoader: | ||
def __init__(self, dataset_file="dataset_cifar10.csv", transforms=None): | ||
self.dataset_file = dataset_file | ||
self.data = genfromtxt(self.dataset_file, delimiter=',') | ||
|
||
# Applies encoding | ||
if transforms != None: | ||
if transforms is not None: | ||
self.data = transforms(self.data) | ||
|
||
def get_train(self): | ||
def get_train(self): | ||
X = self.data[1:24] | ||
y = self.data[27] | ||
slope = self.data[26]-self.data[-1] | ||
|
||
x_train, y_train, x_test, y_test = train_test_split(X, y, test_size=0.2, random_state=0) | ||
return (x_train, y_train), (x_test,y_test), slope | ||
slope = self.data[26] - self.data[-1] | ||
|
||
# Split the data into train and test sets | ||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) | ||
|
||
# Scale the data using StandardScaler | ||
scaler = StandardScaler() | ||
X_train = scaler.fit_transform(X_train) | ||
X_test = scaler.transform(X_test) | ||
|
||
return (X_train, y_train), (X_test, y_test), slope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters