destimator/described_estimator.py
def from_file(cls, f):
        """
        Read the described classifier from file. `f` can be a path or a
        file-like object.

        """
        zf = zipfile.ZipFile(f)
        extract_dir = tempfile.mkdtemp()
        try:
            zf.extractall(extract_dir)
            data = {}
            for fn in zf.namelist():
                fn_full = os.path.join(extract_dir, fn)
                if fn == 'model.bin':
                    data['clf'] = joblib.load(fn_full)
                elif fn == 'features_train.bin':
                    data['features_train'] = joblib.load(fn_full)
                elif fn == 'labels_train.bin':
                    data['labels_train'] = joblib.load(fn_full)
                elif fn == 'features_test.bin':
                    data['features_test'] = joblib.load(fn_full)
                elif fn == 'labels_test.bin':
                    data['labels_test'] = joblib.load(fn_full)
                elif fn == 'metadata.json':
                    data['metadata'] = json.loads(open(fn_full, 'rt').read())
            return cls(
                clf=data['clf'],
                features_train=data['features_train'],
                labels_train=data['labels_train'],
                features_test=data['features_test'],
                labels_test=data['labels_test'],
                metadata=data['metadata'],
            )
        finally:
            shutil.rmtree(extract_dir)

        Read the described classifier from file. `f` can be a path or a
        file-like object.

        
Read the described classifier from file. `f` can be a path or a
file-like object.
Read the described classifier from file . ` f ` can be a path or a file - like object .
def from_file(cls, f):
        zf = zipfile.ZipFile(f)
        extract_dir = tempfile.mkdtemp()
        try:
            zf.extractall(extract_dir)
            data = {}
            for fn in zf.namelist():
                fn_full = os.path.join(extract_dir, fn)
                if fn == 'model.bin':
                    data['clf'] = joblib.load(fn_full)
                elif fn == 'features_train.bin':
                    data['features_train'] = joblib.load(fn_full)
                elif fn == 'labels_train.bin':
                    data['labels_train'] = joblib.load(fn_full)
                elif fn == 'features_test.bin':
                    data['features_test'] = joblib.load(fn_full)
                elif fn == 'labels_test.bin':
                    data['labels_test'] = joblib.load(fn_full)
                elif fn == 'metadata.json':
                    data['metadata'] = json.loads(open(fn_full, 'rt').read())
            return cls(
                clf=data['clf'],
                features_train=data['features_train'],
                labels_train=data['labels_train'],
                features_test=data['features_test'],
                labels_test=data['labels_test'],
                metadata=data['metadata'],
            )
        finally:
            shutil.rmtree(extract_dir)
def from_file ( cls , f ) : zf = zipfile . ZipFile ( f ) extract_dir = tempfile . mkdtemp ( ) try : zf . extractall ( extract_dir ) data = { } for fn in zf . namelist ( ) : fn_full = os . path . join ( extract_dir , fn ) if fn == 'model.bin' : data [ 'clf' ] = joblib . load ( fn_full ) elif fn == 'features_train.bin' : data [ 'features_train' ] = joblib . load ( fn_full ) elif fn == 'labels_train.bin' : data [ 'labels_train' ] = joblib . load ( fn_full ) elif fn == 'features_test.bin' : data [ 'features_test' ] = joblib . load ( fn_full ) elif fn == 'labels_test.bin' : data [ 'labels_test' ] = joblib . load ( fn_full ) elif fn == 'metadata.json' : data [ 'metadata' ] = json . loads ( open ( fn_full , 'rt' ) . read ( ) ) return cls ( clf = data [ 'clf' ] , features_train = data [ 'features_train' ] , labels_train = data [ 'labels_train' ] , features_test = data [ 'features_test' ] , labels_test = data [ 'labels_test' ] , metadata = data [ 'metadata' ] , ) finally : shutil . rmtree ( extract_dir )
Read the described classifier from file.
Read the described classifier from file .
"""
        Read the described classifier from file. `f` can be a path or a
        file-like object.

        """
cls
f