Best Python code snippet using localstack_python
processor.py
Source: processor.py
...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...
run_preprocessing.py
Source: run_preprocessing.py
...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:...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!