# Path: scripts/keras/keras/utils/generic_utils.py
# class Progbar(object):
#     def __init__(self, target, width=30, verbose=1):
#         '''
#             @param target: total number of steps expected
#         '''
#         self.width = width
#         self.target = target
#         self.sum_values = {}
#         self.unique_values = []
#         self.start = time.time()
#         self.total_width = 0
#         self.seen_so_far = 0
#         self.verbose = verbose
# 
#     def update(self, current, values=[]):
#         '''
#             @param current: index of current step
#             @param values: list of tuples (name, value_for_last_step).
#             The progress bar will display averages for these values.
#         '''
#         for k, v in values:
#             if k not in self.sum_values:
#                 self.sum_values[k] = [v * (current-self.seen_so_far), current-self.seen_so_far]
#                 self.unique_values.append(k)
#             else:
#                 self.sum_values[k][0] += v * (current-self.seen_so_far)
#                 self.sum_values[k][1] += (current-self.seen_so_far)
#         self.seen_so_far = current
# 
#         now = time.time()
#         if self.verbose == 1:
#             prev_total_width = self.total_width
#             sys.stdout.write("\b" * prev_total_width)
#             sys.stdout.write("\r")
# 
#             numdigits = int(np.floor(np.log10(self.target))) + 1
#             barstr = '%%%dd/%%%dd [' % (numdigits, numdigits)
#             bar = barstr % (current, self.target)
#             prog = float(current)/self.target
#             prog_width = int(self.width*prog)
#             if prog_width > 0:
#                 bar += ('='*(prog_width-1))
#                 if current < self.target:
#                     bar += '>'
#                 else:
#                     bar += '='
#             bar += ('.'*(self.width-prog_width))
#             bar += ']'
#             sys.stdout.write(bar)
#             self.total_width = len(bar)
#             
#             if current:
#                 time_per_unit = (now - self.start) / current
#             else:
#                 time_per_unit = 0
#             eta = time_per_unit*(self.target - current)
#             info = ''
#             if current < self.target:
#                 info += ' - ETA: %ds' % eta
#             else:
#                 info += ' - %ds' % (now - self.start)
#             for k in self.unique_values:
#                 info += ' - %s: %.4f' % (k, self.sum_values[k][0]/self.sum_values[k][1])
# 
#             self.total_width += len(info)
#             if prev_total_width > self.total_width:
#                 info += ((prev_total_width-self.total_width) * " ")
# 
#             sys.stdout.write(info)
#             sys.stdout.flush()
# 
#             if current >= self.target:
#                 sys.stdout.write("\n")
# 
#         if self.verbose == 2:
#             if current >= self.target:
#                 info = '%ds' % (now - self.start)
#                 for k in self.unique_values:
#                     info += ' - %s: %.4f' % (k, self.sum_values[k][0]/self.sum_values[k][1])
#                 sys.stdout.write(info + "\n")
# 
# 
#     def add(self, n, values=[]):
#         self.update(self.seen_so_far+n, values)
# 
# def printv(v, prefix=''):
#     if type(v) == dict:
#         if 'name' in v:
#             print(prefix + '#' + v['name'])
#             del v['name']
#         prefix += '...'
#         for nk, nv in v.items():
#             if type(nv) in [dict, list]:
#                 print(prefix + nk + ':')
#                 printv(nv, prefix)
#             else:
#                 print(prefix + nk + ':' + str(nv))
#     elif type(v) == list:
#         prefix += '...'
#         for i, nv in enumerate(v):
#             print(prefix + '#' + str(i))
#             printv(nv, prefix) 
#     else:
#         prefix += '...'
#         print(prefix + str(v))


import theano
import theano.tensor as T
import numpy as np
import warnings
import time, copy
        import h5py
        import h5py
from . import optimizers
from . import objectives
from . import regularizers
from . import constraints
from .utils.generic_utils import Progbar, printv
from six.moves import range
            if verbose==1:
                progbar.update(batch_end)

        return preds

    def predict_proba(self, X, batch_size=128, verbose=1):
        preds = self.predict(X, batch_size, verbose)
        if preds.min()<0 or preds.max()>1:
            warnings.warn("Network returning invalid probability values.")
        return preds


    def predict_classes(self, X, batch_size=128, verbose=1):
        proba = self.predict(X, batch_size=batch_size, verbose=verbose)
        if self.class_mode == "categorical":
            return proba.argmax(axis=-1)
        else:
            return (proba>0.5).astype('int32')


    def evaluate(self, X, y, batch_size=128, show_accuracy=False, verbose=1):
        X = standardize_X(X)
        y = standardize_y(y)

        if show_accuracy:
            tot_acc = 0.
        tot_score = 0.

        batches = make_batches(len(y), batch_size)
        if verbose:

# Path: scripts/keras/keras/utils/generic_utils.py
# class Progbar(object):
#     def __init__(self, target, width=30, verbose=1):
#         '''
#             @param target: total number of steps expected
#         '''
#         self.width = width
#         self.target = target
#         self.sum_values = {}
#         self.unique_values = []
#         self.start = time.time()
#         self.total_width = 0
#         self.seen_so_far = 0
#         self.verbose = verbose
# 
#     def update(self, current, values=[]):
#         '''
#             @param current: index of current step
#             @param values: list of tuples (name, value_for_last_step).
#             The progress bar will display averages for these values.
#         '''
#         for k, v in values:
#             if k not in self.sum_values:
#                 self.sum_values[k] = [v * (current-self.seen_so_far), current-self.seen_so_far]
#                 self.unique_values.append(k)
#             else:
#                 self.sum_values[k][0] += v * (current-self.seen_so_far)
#                 self.sum_values[k][1] += (current-self.seen_so_far)
#         self.seen_so_far = current
# 
#         now = time.time()
#         if self.verbose == 1:
#             prev_total_width = self.total_width
#             sys.stdout.write("\b" * prev_total_width)
#             sys.stdout.write("\r")
# 
#             numdigits = int(np.floor(np.log10(self.target))) + 1
#             barstr = '%%%dd/%%%dd [' % (numdigits, numdigits)
#             bar = barstr % (current, self.target)
#             prog = float(current)/self.target
#             prog_width = int(self.width*prog)
#             if prog_width > 0:
#                 bar += ('='*(prog_width-1))
#                 if current < self.target:
#                     bar += '>'
#                 else:
#                     bar += '='
#             bar += ('.'*(self.width-prog_width))
#             bar += ']'
#             sys.stdout.write(bar)
#             self.total_width = len(bar)
#             
#             if current:
#                 time_per_unit = (now - self.start) / current
#             else:
#                 time_per_unit = 0
#             eta = time_per_unit*(self.target - current)
#             info = ''
#             if current < self.target:
#                 info += ' - ETA: %ds' % eta
#             else:
#                 info += ' - %ds' % (now - self.start)
#             for k in self.unique_values:
#                 info += ' - %s: %.4f' % (k, self.sum_values[k][0]/self.sum_values[k][1])
# 
#             self.total_width += len(info)
#             if prev_total_width > self.total_width:
#                 info += ((prev_total_width-self.total_width) * " ")
# 
#             sys.stdout.write(info)
#             sys.stdout.flush()
# 
#             if current >= self.target:
#                 sys.stdout.write("\n")
# 
#         if self.verbose == 2:
#             if current >= self.target:
#                 info = '%ds' % (now - self.start)
#                 for k in self.unique_values:
#                     info += ' - %s: %.4f' % (k, self.sum_values[k][0]/self.sum_values[k][1])
#                 sys.stdout.write(info + "\n")
# 
# 
#     def add(self, n, values=[]):
#         self.update(self.seen_so_far+n, values)
# 
# def printv(v, prefix=''):
#     if type(v) == dict:
#         if 'name' in v:
#             print(prefix + '#' + v['name'])
#             del v['name']
#         prefix += '...'
#         for nk, nv in v.items():
#             if type(nv) in [dict, list]:
#                 print(prefix + nk + ':')
#                 printv(nv, prefix)
#             else:
#                 print(prefix + nk + ':' + str(nv))
#     elif type(v) == list:
#         prefix += '...'
#         for i, nv in enumerate(v):
#             print(prefix + '#' + str(i))
#             printv(nv, prefix) 
#     else:
#         prefix += '...'
#         print(prefix + str(v))


# Path: scripts/keras/keras/models.py
import theano
import theano.tensor as T
import numpy as np
import warnings
import time, copy
        import h5py
        import h5py
from . import optimizers
from . import objectives
from . import regularizers
from . import constraints
from .utils.generic_utils import Progbar, printv
from six.moves import range

            if verbose==1:
                progbar.update(batch_end)

        return preds

    def predict_proba(self, X, batch_size=128, verbose=1):
        preds = self.predict(X, batch_size, verbose)
        if preds.min()<0 or preds.max()>1:
            warnings.warn("Network returning invalid probability values.")
        return preds


    def predict_classes(self, X, batch_size=128, verbose=1):
        proba = self.predict(X, batch_size=batch_size, verbose=verbose)
        if self.class_mode == "categorical":
            return proba.argmax(axis=-1)
        else:
            return (proba>0.5).astype('int32')


    def evaluate(self, X, y, batch_size=128, show_accuracy=False, verbose=1):
        X = standardize_X(X)
        y = standardize_y(y)

        if show_accuracy:
            tot_acc = 0.
        tot_score = 0.

        batches = make_batches(len(y), batch_size)
        if verbose:

            progbar = Progbar(target=len(y), verbose=verbose)