Exemplo n.º 1
0
class Analytics:
    def __init__(self, config):
        self.config = config

        self.downloader = Downloader(config)
        self.parser = Parser(config)
        self.analyser = Analyser(config)

    def generate_report(self):
        if self.config.download:
            self.downloader.download()
        self.parser.parse()
        self.analyser.analyse()
        return self.config
Exemplo n.º 2
0
class Analytics:
    def __init__(self, config):
        self.config = config

        self.downloader = Downloader(config)
        self.parser = Parser(config)
        self.analyser = Analyser(config)

    def download_logs(self):
        print("here")
        if self.config.download:
            self.downloader.download()

    def generate_report(self):
        #if self.config.download:
        #    self.downloader.download()
        self.parser.parse()
        self.analyser.analyse()
        return self.config
Exemplo n.º 3
0
def main():
    args = arg_parser()

    parser = Parser()
    flow = ControlFlowGraph()
    analyser = Analyser()
    codegen = MachineCode()

    with open(args.input_file, 'r') as file_in:
        content = file_in.read()

    try:
        tree = parser.parse(content)
        symtab, commands = analyser.analyse(tree)
        g = flow.convert(commands, symtab)
        code = codegen.start(g, symtab)
    except CompilerError:
        exit(1)

    with open(args.output_file, 'w') as file_out:
        file_out.write(code)
Exemplo n.º 4
0
    # !!! It's already done at donors.py !!! #

    # Correlation between TARGET_D and the predictors
    TARGET_D_corr = raw_dat.corr()["TARGET_D"].copy()
    TARGET_D_corr.sort(ascending = False)
    TARGET_D_corr

    # TODO: see how donations are distributed among age groups
    # TODO: see how donations are distributed per gender

    # The majority of the donations are smaller than 20 dollars.

    #### Preprocessing ####

    # Gets some redundant variables based on variance, sparsity & common sense
    redundant_vars = Analyser.get_redundant_vars(cfg, raw_dat)

    # Drops redundant cols
    dat = raw_dat.drop(redundant_vars, axis = 1)

    # Imputes the data and fills in the missing values
    dat = Preprocessor.fill_nans(raw_dat)

    # Shuffles observations
    dat = dat.apply(np.random.permutation)

    #### Feature Selection ####

    # Gets important variables
    important_vars = Analyser.get_important_vars(cfg, dat)
    important_vars.extend(['TARGET_B'])
Exemplo n.º 5
0
    def __init__(self, config):
        self.config = config

        self.downloader = Downloader(config)
        self.parser = Parser(config)
        self.analyser = Analyser(config)