How to use the a2ml.api.utils.decorators.authenticated function in a2ml

To help you get started, we’ve selected a few a2ml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github augerai / a2ml / a2ml / api / auger / model.py View on Github external
    @authenticated
    @with_project(autocreate=False)
    def build_review_data(self, project, model_id, locally, output):
        return Model(self.ctx, project).build_review_data(model_id, locally, output)
github augerai / a2ml / a2ml / api / auger / project.py View on Github external
    @authenticated
    def start(self, name):
        old_name, name, project = self._setup_op(name)
        if not project.is_running():
            self.ctx.log('Starting Project...')
            project.start()
            self.ctx.log('Started Project %s' % name)
        else:
            self.ctx.log('Project is already running...')
        return {'running': name}
github augerai / a2ml / a2ml / api / azure / model.py View on Github external
    @authenticated
    def predict(self, filename, model_id, threshold=None, locally=False, data=None, columns=None, 
        predicted_at=None, output=None, json_result=False, count_in_result=False, prediction_id=None
        ):
        ds = DataFrame.create_dataframe(filename, data, columns)
        model_path = self.ctx.config.get_model_path(model_id)
        options = fsclient.read_json_file(os.path.join(model_path, "options.json"))

        results, results_proba, proba_classes, target_categories = \
            self._predict_locally(ds.df, model_id, threshold) if locally else self._predict_remotely(ds.df, model_id, threshold)

        if target_categories and len(target_categories) == 2:
            for idx, item in enumerate(target_categories):
                if item == "False":
                    target_categories[idx] = False
                if item == "True":
                    target_categories[idx] = True
github augerai / a2ml / a2ml / api / auger / project.py View on Github external
    @authenticated
    def stop(self, name):
        old_name, name, project = self._setup_op(name)
        if project.is_running():
            self.ctx.log('Stopping Project...')
            project.stop()
            self.ctx.log('Stopped Project %s' % name)
        else:
            self.ctx.log('Project is not running...')
        return {'stopped': name}
github augerai / a2ml / a2ml / api / azure / dataset.py View on Github external
    @authenticated
    def create(self, source = None, validation=False):
        ws = self._get_ws(True)
        if source is None:
            source = self.ctx.config.get('source', None)
        if source is None:
            raise AzureException('Please specify data source file...')

        if source.startswith("http:") or source.startswith("https:"):
            url_info = get_remote_file_info(source)
            if self.ctx.config.get('source_format', "") == "parquet" or \
               url_info.get('file_ext', "").endswith(".parquet"):
                dataset = Dataset.Tabular.from_parquet_files(path=source)
            else:        
                dataset = Dataset.Tabular.from_delimited_files(path=source)

            dataset_name = url_info.get('file_name')+url_info.get('file_ext')
github augerai / a2ml / a2ml / api / auger / project.py View on Github external
    @authenticated
    def delete(self, name):
        old_name, name, project = self._setup_op(name)
        project.delete()
        if name == old_name:
            self._set_project_config(None)
        self.ctx.log('Deleted Project %s' % name)
        return {'deleted': name}
github augerai / a2ml / a2ml / api / auger / project.py View on Github external
    @authenticated
    def select(self, name):
        old_name, name, project = self._setup_op(name, False)
        if name != old_name:
            self._set_project_config(name)
        self.ctx.log('Selected Project %s' % name)
        return {'selected': name}
github augerai / a2ml / a2ml / api / auger / experiment.py View on Github external
    @authenticated
    @with_dataset
    def history(self, dataset):
        name = self.ctx.config.get('experiment/name', None)
        if name is None:
            raise AugerException('Please specify Experiment name...')
        for exp_run in iter(Experiment(self.ctx, dataset, name).history()):
            self.ctx.log("run id: {}, start time: {}, status: {}".format(
                exp_run.get('id'),
                exp_run.get('model_settings').get('start_time'),
                exp_run.get('status')))
        return {'history': Experiment(self.ctx, dataset, name).history()}
github augerai / a2ml / a2ml / api / auger / experiment.py View on Github external
    @authenticated
    @with_dataset
    def leaderboard(self, dataset, run_id = None):
        name = self.ctx.config.get('experiment/name', None)
        if name is None:
            raise AugerException('Please specify Experiment name...')
        if run_id is None:
            run_id = self.ctx.config.get(
                'experiment/experiment_session_id', None)
        leaderboard, status, run_id = Experiment(
            self.ctx, dataset, name).leaderboard(run_id)
        if leaderboard is None:
            raise AugerException('No leaderboard was found...')
        self.ctx.log('Leaderboard for Run %s' % run_id)
        print_table(self.ctx.log, leaderboard[::-1])
        messages = {
            'preprocess': 'Search is preprocessing data for training...',
github augerai / a2ml / a2ml / api / azure / experiment.py View on Github external
    @authenticated
    def list(self):
        ws = AzureProject(self.ctx)._get_ws()
        experiments = Experiment.list(workspace=ws)
        nexperiments = len(experiments)
        experiments = [e.name for e in experiments]
        for name in experiments:
            self.ctx.log(name)
        self.ctx.log('%s Experiment(s) listed' % str(nexperiments))
        return {'experiments': experiments}