Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bagustris committed Apr 18, 2024
1 parent 34cd9eb commit c592bd9
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 38 deletions.
2 changes: 1 addition & 1 deletion nkululeko/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

def main(src_dir):
parser = argparse.ArgumentParser(
description="Call the nkululeko framework.")
description="Call the nkululeko DEMO framework.")
parser.add_argument("--config", default="exp.ini",
help="The base configuration")
parser.add_argument(
Expand Down
21 changes: 13 additions & 8 deletions nkululeko/explore.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# explore.py
# explore the feature sets

from nkululeko.experiment import Experiment
import configparser
from nkululeko.utils.util import Util
from nkululeko.constants import VERSION
import argparse
import configparser
import os

from nkululeko.constants import VERSION
from nkululeko.experiment import Experiment
from nkululeko.utils.util import Util


def main(src_dir):
parser = argparse.ArgumentParser(description="Call the nkululeko framework.")
parser.add_argument("--config", default="exp.ini", help="The base configuration")
parser = argparse.ArgumentParser(
description="Call the nkululeko EXPLORE framework.")
parser.add_argument("--config", default="exp.ini",
help="The base configuration")
args = parser.parse_args()
if args.config is not None:
config_file = args.config
Expand Down Expand Up @@ -46,9 +49,11 @@ def main(src_dir):

# split into train and test
expr.fill_train_and_tests()
util.debug(f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")
util.debug(
f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")

plot_feats = eval(util.config_val("EXPL", "feature_distributions", "False"))
plot_feats = eval(util.config_val(
"EXPL", "feature_distributions", "False"))
tsne = eval(util.config_val("EXPL", "tsne", "False"))
scatter = eval(util.config_val("EXPL", "scatter", "False"))
spotlight = eval(util.config_val("EXPL", "spotlight", "False"))
Expand Down
30 changes: 18 additions & 12 deletions nkululeko/multidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@

import argparse
import ast
import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt
import configparser
import os

import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sn

import nkululeko.glob_conf as glob_conf
from nkululeko.aug_train import doit as aug_train
from nkululeko.experiment import Experiment
import configparser
from nkululeko.utils.util import Util
from nkululeko.nkululeko import doit as nkulu
from nkululeko.aug_train import doit as aug_train
import nkululeko.glob_conf as glob_conf
from nkululeko.utils.util import Util


def main(src_dir):
parser = argparse.ArgumentParser(description="Call the nkululeko framework.")
parser.add_argument("--config", default="exp.ini", help="The base configuration")
parser = argparse.ArgumentParser(
description="Call the nkululeko MULTIDB framework.")
parser.add_argument("--config", default="exp.ini",
help="The base configuration")
args = parser.parse_args()
if args.config is not None:
config_file = args.config
Expand Down Expand Up @@ -54,7 +58,8 @@ def main(src_dir):
dataset = datasets[i]
print(f"running {dataset}")
if extra_trains:
extra_trains_1 = extra_trains.removeprefix("[").removesuffix("]")
extra_trains_1 = extra_trains.removeprefix(
"[").removesuffix("]")
config["DATA"]["databases"] = f"['{dataset}', {extra_trains_1}]"
extra_trains_2 = ast.literal_eval(extra_trains)
for extra_train in extra_trains_2:
Expand All @@ -67,7 +72,8 @@ def main(src_dir):
test = datasets[j]
print(f"running train: {train}, test: {test}")
if extra_trains:
extra_trains_1 = extra_trains.removeprefix("[").removesuffix("]")
extra_trains_1 = extra_trains.removeprefix(
"[").removesuffix("]")
config["DATA"][
"databases"
] = f"['{train}', '{test}', {extra_trains_1}]"
Expand Down
21 changes: 13 additions & 8 deletions nkululeko/predict.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# predict.py
# use some model and add automatically predicted labels to train and test splits, than save as a new dataset
# use some model and add automatically predicted labels to train and test splits
# then save as a new dataset

from nkululeko.experiment import Experiment
import configparser
from nkululeko.utils.util import Util
from nkululeko.constants import VERSION
import argparse
import configparser
import os

from nkululeko.constants import VERSION
from nkululeko.experiment import Experiment
from nkululeko.utils.util import Util


def main(src_dir):
parser = argparse.ArgumentParser(description="Call the nkululeko framework.")
parser.add_argument("--config", default="exp.ini", help="The base configuration")
parser = argparse.ArgumentParser(
description="Call the nkululeko PREDICT framework.")
parser.add_argument("--config", default="exp.ini",
help="The base configuration")
args = parser.parse_args()
if args.config is not None:
config_file = args.config
Expand Down Expand Up @@ -41,7 +45,8 @@ def main(src_dir):

# split into train and test
expr.fill_train_and_tests()
util.debug(f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")
util.debug(
f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")

# process the data
df = expr.autopredict()
Expand Down
3 changes: 1 addition & 2 deletions nkululeko/reporter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Reporter module.
"""Reporter module.
This module contains the Reporter class which is responsible for generating reports.
"""
Expand Down
19 changes: 12 additions & 7 deletions nkululeko/resample.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# resample.py
# change the sampling rate for train and test splits

from nkululeko.experiment import Experiment
import configparser
from nkululeko.utils.util import Util
from nkululeko.constants import VERSION
import argparse
import configparser
import os

import pandas as pd

from nkululeko.augmenting.resampler import Resampler
from nkululeko.constants import VERSION
from nkululeko.experiment import Experiment
from nkululeko.utils.util import Util


def main(src_dir):
parser = argparse.ArgumentParser(description="Call the nkululeko framework.")
parser.add_argument("--config", default="exp.ini", help="The base configuration")
parser = argparse.ArgumentParser(
description="Call the nkululeko RESAMPLE framework.")
parser.add_argument("--config", default="exp.ini",
help="The base configuration")
args = parser.parse_args()
if args.config is not None:
config_file = args.config
Expand Down Expand Up @@ -48,7 +52,8 @@ def main(src_dir):

# split into train and test
expr.fill_train_and_tests()
util.debug(f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")
util.debug(
f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")

sample_selection = util.config_val("RESAMPLE", "sample_selection", "all")
if sample_selection == "all":
Expand Down

0 comments on commit c592bd9

Please sign in to comment.