fadzwan commited on
Commit
f0b4e7a
·
verified ·
1 Parent(s): 709ddcf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -9,9 +9,32 @@ import pandas as pd
9
 
10
  def load_data():
11
  # Load data from CSV files
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  X_train = pd.read_csv('slump_test.data.csv').values[:,:-1]
13
- X_train = X_train.drop('SLUM (cm)',axis=1)
14
  y_train = pd.read_csv('slump_test.data.csv').values[:, -1]
 
15
 
16
 
17
  return X_train, y_train
 
9
 
10
  def load_data():
11
  # Load data from CSV files
12
+ df = pd.read_csv('slump_test.data.csv')
13
+ df.drop(columns=['SLUMP(cm)'], inplace=True)
14
+ df.dropna(inplace=True)
15
+ # df = pd.get_dummies(df, drop_first=True)
16
+ # numeric_columns = df.select_dtypes(include=['int64', 'float64']).columns
17
+ # # Creating a MinMaxScaler object
18
+ # scaler = MinMaxScaler()
19
+ # # Normalizing numeric features
20
+ # df[numeric_columns] = scaler.fit_transform(df[numeric_columns])
21
+ # scaler = StandardScaler()
22
+ # df_scaled = pd.DataFrame(scaler.fit_transform(df), columns=df.columns)
23
+
24
+ # # Perform PCA
25
+ # pca = PCA()
26
+ # df_pca = pca.fit_transform(df_scaled)
27
+
28
+ # Calculate explained variance
29
+ # explained_variance = pca.explained_variance_ratio_
30
+
31
+ # Create a DataFrame with the PCA results
32
+ pca_columns = [f'PC{i+1}' for i in range(df_scaled.shape[1])]
33
+ df_pca = pd.DataFrame(df_pca, columns=pca_columns)
34
+
35
  X_train = pd.read_csv('slump_test.data.csv').values[:,:-1]
 
36
  y_train = pd.read_csv('slump_test.data.csv').values[:, -1]
37
+
38
 
39
 
40
  return X_train, y_train