# Path: classification/metadata.py
# PRIMARY_VESSEL_CLASS_COLUMN = 'label'
# VESSEL_CLASS_DETAILED_NAMES = sorted(atomic(schema))
# VESSEL_CATEGORIES = sorted(categories(schema))
# TRAINING_SPLIT = 'Training'
# TEST_SPLIT = 'Test'
#     MAX_WEIGHT = 100.0
# def atomic(obj):
# def categories(obj, include_atomic=True):
# def stable_hash(x):
#     def __init__(self,
#                  metadata_dict,
#                  fishing_ranges_map):
#     def vessel_weight(self, id_):
#     def vessel_label(self, label_name, id_):
#     def ids_for_split(self, split):
#     def weighted_training_list(self,
#                                random_state,
#                                split,
#                                max_replication_factor,
#                                row_filter=lambda row: True,
#                                boundary=1):
#     def fishing_range_only_list(self, random_state, split):
# def read_vessel_time_weighted_metadata_lines(available_ids, lines,
#                                              fishing_range_dict, split):
# def read_vessel_time_weighted_metadata(available_ids,
#                                        metadata_file,
#                                        fishing_range_dict={},
#                                        split=0):
# def read_vessel_multiclass_metadata_lines(available_ids, lines,
#                                           fishing_range_dict):
# def metadata_file_reader(metadata_file):
# def read_vessel_multiclass_metadata(available_ids,
#                                     metadata_file,
#                                     fishing_range_dict={}):
# def find_available_ids(feature_path):
# def parse_date(date):
# def read_fishing_ranges(fishing_range_file):
# def build_multihot_lookup_table():
# def multihot_encode(label):
# class VesselMetadata(object):


import subprocess
import numpy as np
import pandas as pd
import hashlib
import argparse
import sys
import six
from classification import metadata
    for sub in label.split('|'):
        for atomic in category_map[sub]:
            parts.add(atomic)
    return parts


def apply_remapping(df, map):
    new_labels = []
    for lbl in df.label:
        if lbl and lbl not in ["unknown", "fishing", "non_fishing"]:
            atoms = disintegrate(lbl)
            new_atoms = set([remapping.get(x, x) for x in atoms])
            if new_atoms == atoms:
                # If no remapping occurred, keep old label as it's likely more compact.
                new_labels.append(lbl)
            else:
                new_labels.append('|'.join(sorted(new_atoms)))
        else:
          new_labels.append(lbl)
    df['label'] = new_labels


def assign_split(df, max_examples, seed=888, check_fishing=False):
    rnd = np.random.RandomState(seed)
    if check_fishing:
        # If we are looking at fishing any vessel can be
        # be fishing, but stratify by all listed types
        labels = sorted(set(df.label))
    else:
        # Otherwise, only allow atomic classes into test

# Path: classification/metadata.py
# PRIMARY_VESSEL_CLASS_COLUMN = 'label'
# VESSEL_CLASS_DETAILED_NAMES = sorted(atomic(schema))
# VESSEL_CATEGORIES = sorted(categories(schema))
# TRAINING_SPLIT = 'Training'
# TEST_SPLIT = 'Test'
#     MAX_WEIGHT = 100.0
# def atomic(obj):
# def categories(obj, include_atomic=True):
# def stable_hash(x):
#     def __init__(self,
#                  metadata_dict,
#                  fishing_ranges_map):
#     def vessel_weight(self, id_):
#     def vessel_label(self, label_name, id_):
#     def ids_for_split(self, split):
#     def weighted_training_list(self,
#                                random_state,
#                                split,
#                                max_replication_factor,
#                                row_filter=lambda row: True,
#                                boundary=1):
#     def fishing_range_only_list(self, random_state, split):
# def read_vessel_time_weighted_metadata_lines(available_ids, lines,
#                                              fishing_range_dict, split):
# def read_vessel_time_weighted_metadata(available_ids,
#                                        metadata_file,
#                                        fishing_range_dict={},
#                                        split=0):
# def read_vessel_multiclass_metadata_lines(available_ids, lines,
#                                           fishing_range_dict):
# def metadata_file_reader(metadata_file):
# def read_vessel_multiclass_metadata(available_ids,
#                                     metadata_file,
#                                     fishing_range_dict={}):
# def find_available_ids(feature_path):
# def parse_date(date):
# def read_fishing_ranges(fishing_range_file):
# def build_multihot_lookup_table():
# def multihot_encode(label):
# class VesselMetadata(object):


# Path: train/create_train_info.py
import subprocess
import numpy as np
import pandas as pd
import hashlib
import argparse
import sys
import six
from classification import metadata

    for sub in label.split('|'):
        for atomic in category_map[sub]:
            parts.add(atomic)
    return parts


def apply_remapping(df, map):
    new_labels = []
    for lbl in df.label:
        if lbl and lbl not in ["unknown", "fishing", "non_fishing"]:
            atoms = disintegrate(lbl)
            new_atoms = set([remapping.get(x, x) for x in atoms])
            if new_atoms == atoms:
                # If no remapping occurred, keep old label as it's likely more compact.
                new_labels.append(lbl)
            else:
                new_labels.append('|'.join(sorted(new_atoms)))
        else:
          new_labels.append(lbl)
    df['label'] = new_labels


def assign_split(df, max_examples, seed=888, check_fishing=False):
    rnd = np.random.RandomState(seed)
    if check_fishing:
        # If we are looking at fishing any vessel can be
        # be fishing, but stratify by all listed types
        labels = sorted(set(df.label))
    else:
        # Otherwise, only allow atomic classes into test

        labels = metadata.VESSEL_CLASS_DETAILED_NAMES