How to use get_raw_path method in localstack

Best Python code snippet using localstack_python

processor.py

Source:processor.py Github

copy

Full Screen

...53 form more useful for classification such as one hot encoding.54 """55 pass56 @classmethod57 def get_raw_path(cls):58 return cls.RAW_DATA_PATHS[cls.NAME]59 @classmethod60 def get_path(cls):61 return cls.DATA_PATHS[cls.NAME]62class EcoliDataProcessor(AbstractDataProcessor):63 NAME = 'ecoli'64 @classmethod65 def convert_raw_data_to_df(cls) -> Tuple[str, DataFrame]:66 """Converts raw ecoli data to a dataframe"""67 # path to raw data file68 path = cls.get_raw_path()69 # names of columns in the dataframe70 names = ['sequence'] + [f'feature_{i}' for i in range(1, 8)] + ['label']71 # create dataframe72 df = pd.read_csv(path, delim_whitespace=True, names=names)73 return cls.NAME, df74class GlassDataProcessor(AbstractDataProcessor):75 NAME = 'glass'76 @classmethod77 def convert_raw_data_to_df(cls) -> Tuple[str, DataFrame]:78 """Converts raw glass data to a dataframe."""79 path = cls.get_raw_path()80 # name of columns in the dataframe81 names = ['index']+[f'feature_{i}' for i in range(9)]+['label']82 # TODO should we drop the index column83 # create dataframe84 df = pd.read_csv(path, names=names)85 return cls.NAME, df86class LetterDataProcessor(AbstractDataProcessor):87 NAME = 'letter'88 NUM_FEATURES = 1689 @classmethod90 def convert_raw_data_to_df(cls) -> Tuple[str, DataFrame]:91 """Converts raw letter data into a dataframe"""92 path = cls.get_raw_path()93 # names of columns94 names = ['label']+[f'feature_{i}' for i in range(cls.NUM_FEATURES)]95 df = pd.read_csv(path, names=names)96 return cls.NAME, df97class OptdigitsDataProcessor(AbstractDataProcessor):98 NAME = 'optdigits'99 NUM_FEATURES = 64100 @classmethod101 def convert_raw_data_to_df(cls) -> Tuple[str, DataFrame]:102 """converts raw optdigits data into dataframe"""103 path = cls.get_raw_path()104 # names of columns105 names = [f'feature_{i}' for i in range(cls.NUM_FEATURES)]+['label']106 df = pd.read_csv(path, names=names)107 return cls.NAME, df108class AbaloneDataProcessor(AbstractDataProcessor):109 NAME = 'abalone'110 NUM_FEATURES = 8111 @classmethod112 def convert_raw_data_to_df(cls) -> Tuple[str, DataFrame]:113 """converts raw optdigits data into dataframe"""114 path = cls.get_raw_path()115 # names of columns116 names = [f'feature_{i}' for i in range(cls.NUM_FEATURES)]+['label']117 df = pd.read_csv(path, names=names)118 return cls.NAME, df119# collect data processors in map for use my loaders120PROCESSOR_MAP = {121 'ecoli': EcoliDataProcessor,122 'glass': GlassDataProcessor,123 'letter': LetterDataProcessor,124 'optdigits': OptdigitsDataProcessor,125 'abalone': AbaloneDataProcessor...

Full Screen

Full Screen

run_preprocessing.py

Source:run_preprocessing.py Github

copy

Full Screen

...5# Setup path helpers and file paths6get_raw_path = lambda file : f"./data/raw/{file}"7get_prep_path = lambda file: f"./data/preprocessed/{file}"8# TODO: Convert path data structure to dict9input_full_train_pos_path = get_raw_path("train_pos_full.txt")10input_full_train_neg_path = get_raw_path("train_neg_full.txt")11input_part_train_pos_path = get_raw_path("part_train_pos.txt")12input_part_train_neg_path = get_raw_path("part_train_neg.txt")13input_test_path = get_raw_path("test_data.txt")14output_full_train_pos_path = get_prep_path("train_pos_full.txt")15output_full_train_neg_path = get_prep_path("train_neg_full.txt")16output_part_train_pos_path = get_prep_path("part_train_pos.txt")17output_part_train_neg_path = get_prep_path("part_train_neg.txt")18output_test_path_noid = get_prep_path("test_prep_noid.txt")19output_test_path = get_prep_path("test_prep.txt")20def run_preprocessing(is_train=False, is_full=True):21 preprocessing = PipelineMMST()22 if is_train and is_full:23 preprocessing.process(24 [ input_full_train_pos_path, input_full_train_neg_path ],25 [ output_full_train_pos_path, output_full_train_neg_path ]26 )27 elif is_train and not is_full:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful