Skip to content

Commit

Permalink
Merge pull request #29 from snega16/snega16
Browse files Browse the repository at this point in the history
Thanks, Good Work. Merged!
  • Loading branch information
sagnik1511 authored Feb 7, 2022
2 parents 2b8fda7 + a0d60ef commit 6e77dc7
Show file tree
Hide file tree
Showing 3 changed files with 724 additions and 1 deletion.
62 changes: 62 additions & 0 deletions tab_automl/automl/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,36 @@ def prepare_x_and_y(self,
print(f"X feature set and target feature has been split...")

return x, y


class ClusteringDataset:
"""
Dataset Class for Clustering.
Currently supports single feature target only.
"""

def __init__(self, path):
# reading the dataset from source
if path.endswith(".txt"):
self.data = pd.read_table(path, delimiter='\s')
elif path.endswith(".json"):
self.data = pd.read_json(path)
elif path.endswith(".xlsx"):
self.data = pd.read_excel(path)
elif path.endswith(".sqlite"):
table_name = input("table name :")
db = sqlite3.connect(path)
self.data = pd.read_sql_query(f'Select * from {table_name}', db)
elif path.endswith(".csv"):
self.data = pd.read_csv(path)
else:
print("File type not supported")
# storing the columns overview
self.columns = pd.Series([str(self.data[feature].dtype) for feature in self.data.columns])
self.labels = None
print(f"Populated the dataframe with data records...")


class Iris:
Expand Down Expand Up @@ -190,3 +220,35 @@ def prepare_x_and_y(self,
print(f"X feature set and target feature has been split...")

return x, y


class Credit_Card_Customer_Data:
"""
Credit_Card_Customer_Data Dataset
============
This class will be an example for
other clustering datasets or for
custom datasets prepared on comma
separated value format to be precise.
"""

def __init__(self):
# reading the dataset from source
self.data = pd.read_csv("tab_automl/datasets/Credit_Card_Customer_Data.csv")
# storing the columns overview
self.columns = pd.Series([str(self.data[feature].dtype) for feature in self.data.columns])
self.labels = None
print(f"Populated the dataframe with data records...")

"""
Defining x
"""

x = self.data
print(f"X feature set has been set...")

return x

Loading

0 comments on commit 6e77dc7

Please sign in to comment.