repo_name stringlengths 6 67 | path stringlengths 5 185 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 962k | license stringclasses 15
values |
|---|---|---|---|---|---|
sanghoon/tf-exercise-gan | datasets/data_celeba.py | 1 | 3494 | from common import plot
import os.path
import glob
import cv2
import random
import numpy as np
class ImgDataset:
def __init__(self, dataDir, i_from=0, i_to=None, shuffle=False, crop=None, resize=None):
self.dataDir = dataDir
self.img_list = glob.glob(os.path.join(dataDir, "*.jpg"))
self.im... | mit |
mdaniel/intellij-community | python/helpers/pydev/_pydevd_bundle/pydevd_thrift.py | 9 | 22067 | """Contains methods for building Thrift structures for interacting with IDE
The methods from this file are used for Python console interaction. Please
note that the debugger still uses XML structures with the similar methods
contained in `pydevd_xml.py` file.
"""
import sys
import traceback
from _pydev_bundle import ... | apache-2.0 |
tomchor/pymicra | pymicra/io.py | 1 | 10722 | """
Defines some useful functions to aid on the input/output of data
"""
from __future__ import absolute_import, print_function, division
#-------------------------------------------
#-------------------------------------------
# INPUT OF DATA
#-------------------------------------------
#----------------------------... | gpl-3.0 |
nhuntwalker/astroML | examples/datasets/plot_sdss_S82standards.py | 5 | 2253 | """
SDSS Standard Star catalog
--------------------------
This demonstrates how to fetch and plot the colors of the SDSS Stripe 82
standard stars, both alone and with the cross-matched 2MASS colors.
"""
# Author: Jake VanderPlas <vanderplas@astro.washington.edu>
# License: BSD
# The figure is an example from astroML:... | bsd-2-clause |
eadgarchen/tensorflow | tensorflow/python/client/notebook.py | 109 | 4791 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
tensorflow/models | research/delf/delf/python/detect_to_retrieve/image_reranking.py | 1 | 12294 | # Copyright 2019 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 |
ndingwall/scikit-learn | examples/linear_model/plot_lasso_coordinate_descent_path.py | 18 | 2882 | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
The coefficients can be forced to be positive.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from itert... | bsd-3-clause |
ibis-project/ibis-bigquery | ibis_bigquery/backcompat.py | 1 | 3812 | """Helpers to make this backend compatible with Ibis versions < 2.0.
Keep in sync with:
https://github.com/ibis-project/ibis/blob/master/ibis/backends/base/__init__.py
TODO: Remove this after Ibis 2.0 release and support for earlier versions of
Ibis < 2.0 is dropped.
"""
import abc
try:
from ibis.common.e... | apache-2.0 |
bennames/AeroComBAT-Project | Tutorials/Validations/flutterValidation.py | 1 | 3742 | # =============================================================================
# HEPHAESTUS VALIDATION 4 - MESHER AND CROSS-SECTIONAL ANALYSIS
# =============================================================================
# IMPORTS:
import sys
import os
import cProfile
sys.path.append(os.path.abspath('..'))
from... | mit |
lfairchild/PmagPy | programs/foldtest.py | 1 | 5959 | #!/usr/bin/env python
import sys
import numpy
import matplotlib
if matplotlib.get_backend() != "TKAgg":
matplotlib.use("TKAgg")
import pylab
import pmagpy.pmag as pmag
from pmag_env import set_env
import pmagpy.pmagplotlib as pmagplotlib
def main():
"""
NAME
foldtest.py
DESCRIPTION
does a... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/matplotlib/projections/__init__.py | 3 | 2213 | from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
from polar import PolarAxes
from matplotlib import axes
class ProjectionRegistry(object):
"""
Manages the set of projections available to the system.
"""
def __init__(self):
self._all_projection_types = {}
def register(self... | gpl-2.0 |
ErBa508/data-science-from-scratch | code/linear_algebra.py | 49 | 3637 | # -*- coding: iso-8859-15 -*-
from __future__ import division # want 3 / 2 == 1.5
import re, math, random # regexes, math functions, random numbers
import matplotlib.pyplot as plt # pyplot
from collections import defaultdict, Counter
from functools import partial
#
# functions for working with vectors
#
def vector_... | unlicense |
googlearchive/rgc-models | response_model/python/metric_learning/metric_learn_hard_examples.py | 1 | 5512 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 |
DataDog/vbench | vbench/git.py | 3 | 9948 | from dateutil import parser
import subprocess
import os
import shutil
import numpy as np
from pandas import Series, DataFrame, Panel
from vbench.utils import run_cmd
import logging
log = logging.getLogger('vb.git')
class Repo(object):
def __init__(self):
raise NotImplementedError
class GitRepo(Repo)... | mit |
AndreasMadsen/tensorflow | tensorflow/examples/learn/text_classification_cnn.py | 13 | 4470 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
jplourenco/bokeh | examples/interactions/us_marriages_divorces/us_marriages_divorces_interactive.py | 26 | 3437 | # coding: utf-8
# Plotting U.S. marriage and divorce statistics
#
# Example code by Randal S. Olson (http://www.randalolson.com)
from bokeh.plotting import figure, show, output_file, ColumnDataSource
from bokeh.models import HoverTool, NumeralTickFormatter
from bokeh.models import SingleIntervalTicker, LinearAxis
imp... | bsd-3-clause |
mrcslws/nupic.research | projects/rsm/util.py | 3 | 18918 | # Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | agpl-3.0 |
kernc/scikit-learn | sklearn/metrics/cluster/__init__.py | 312 | 1322 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
ChinaQuants/tushare | tushare/util/store.py | 40 | 1124 | # -*- coding:utf-8 -*-
"""
Created on 2015/02/04
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
import pandas as pd
import tushare as ts
from pandas import compat
import os
class Store(object):
def __init__(self, data=None, name=None, path=None):
if isinstance(data, pd.DataFrame):
... | bsd-3-clause |
Microsoft/multiverso | binding/python/examples/theano/cnn.py | 6 | 5128 | #!/usr/bin/env python
# coding:utf8
"""
This code is adapted from
https://github.com/benanne/theano-tutorial/blob/master/6_convnet.py
The MIT License (MIT)
Copyright (c) 2015 Sander Dieleman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation fi... | mit |
armenvod/phone_match | testing_plz.py | 1 | 1251 | '''phone1 = 'Samsung Galaxy S8 Smartphone, Android, 5.8", 4G LTE, SIM Free, 64GB'
print(phone1.replace(',',''))'''
'''def brand_search(phone):
result = []
phone_split = phone.split()
string_length = len(phone_split)
i=0
while i < string_length:
empty = []
phones = fon.getdevice(ph... | mit |
samhollenbach/Galaxy2 | Reader.py | 1 | 2657 | import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import sys
REPEAT = True
SAVE_IMAGES = False
def randrange(n, vmin, vmax):
return (vmax - vmin)*np.random.rand(n) + vmin
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.has_been_closed = False
ax.set_axis_... | mit |
cellnopt/cellnopt | cno/boolean/steady.py | 1 | 36274 | from cno.core.base import CNOBase
from cno.core.results import BooleanResults
from cno.core.models import BooleanModels
from cno.misc.profiler import do_profile
from cno.io.reactions import Reaction
import pandas as pd
import numpy as np
import pylab
import time
import bottleneck as bn
from collections import default... | bsd-2-clause |
KennyCandy/HAR | _module123/CC_64_32.py | 1 | 17631 | # Note that the dataset must be already downloaded for this script to work, do:
# $ cd data/
# $ python download_dataset.py
# quoc_trinh
import tensorflow as tf
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from sklearn import metrics
import os
import sys
import datetime
# get current... | mit |
github4ry/pathomx | pathomx/plugins/multivariate/pca.py | 2 | 1960 | from sklearn.decomposition import PCA
pca = PCA(n_components=config['number_of_components'])
pca.fit(input_data.values)
import pandas as pd
import numpy as np
# Build scores into a dso no_of_samples x no_of_principal_components
scores = pd.DataFrame(pca.transform(input_data.values))
scores.index = input_data.index
... | gpl-3.0 |
q1ang/scikit-learn | sklearn/decomposition/__init__.py | 147 | 1421 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA
from .incrementa... | bsd-3-clause |
DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/sklearn/cluster/tests/test_spectral.py | 1 | 7954 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | mit |
leggitta/mne-python | mne/cov.py | 2 | 71951 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import copy as cp
import os
from math import floor, ceil, log
import itertools as itt
import warnings
import ... | bsd-3-clause |
alexeyum/scikit-learn | examples/model_selection/plot_confusion_matrix.py | 47 | 2495 | """
================
Confusion matrix
================
Example of confusion matrix usage to evaluate the quality
of the output of a classifier on the iris data set. The
diagonal elements represent the number of points for which
the predicted label is equal to the true label, while
off-diagonal elements are those that ... | bsd-3-clause |
jpedroan/megua | megua/ug.py | 1 | 20733 | # coding=utf-8
r"""
UnifiedGraphics - This module defines common operations for graphics.
AUTHORS:
- Pedro Cruz (2016-01): First version (refactoring old "megua" for SMC).
DISCUSSION:
Image sources are:
- sage commands (plots, graphcs, etc)
- R commands
- Static images
- Python Matplotlib and other python libs
-... | gpl-3.0 |
ryfeus/lambda-packs | Skimage_numpy/source/scipy/stats/_multivariate.py | 13 | 99071 | #
# Author: Joris Vankerschaver 2013
#
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.linalg
from scipy.misc import doccer
from scipy.special import gammaln, psi, multigammaln
from scipy._lib._util import check_random_state
from scipy.linalg.blas import dro... | mit |
lotrus28/TaboCom | linear_model/model_pick/random_forest/parallel_script.py | 1 | 3560 | import itertools
import os.path
import sys
import subprocess
import time
import fileinput
import numpy as np
import pandas as pd
# Enter 1 parameter: otu table with reads
path = sys.argv[1]
cond = path.split('/')[-1].split('.')[0]
def teach_predictor(path, params, same, job, wait):
time.sleep(1)
if not(wait ... | apache-2.0 |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/matplotlib/testing/jpl_units/StrConverter.py | 23 | 5293 | #===========================================================================
#
# StrConverter
#
#===========================================================================
"""StrConverter module containing class StrConverter."""
#===========================================================================
# Place al... | gpl-3.0 |
Solid-Mechanics/matplotlib-4-abaqus | matplotlib/testing/jpl_units/Epoch.py | 6 | 7147 | #===========================================================================
#
# Epoch
#
#===========================================================================
"""Epoch module."""
#===========================================================================
# Place all imports after here.
#
from __future__ impo... | mit |
jmmease/pandas | pandas/tests/io/formats/test_eng_formatting.py | 22 | 8085 | import numpy as np
import pandas as pd
from pandas import DataFrame
from pandas.compat import u
import pandas.io.formats.format as fmt
from pandas.util import testing as tm
class TestEngFormatter(object):
def test_eng_float_formatter(self):
df = DataFrame({'A': [1.41, 141., 14100, 1410000.]})
fm... | bsd-3-clause |
RoyNexus/python | Market Sim (3rd4th Homework)/marketsim.py | 1 | 7615 | # QSTK Imports
import QSTK.qstkutil.qsdateutil as du
#import QSTK.qstkutil.tsutil as tsu
import QSTK.qstkutil.DataAccess as da
# Third Party Imports
import datetime as dt
import math as math
import pandas as pd
import numpy as np
import sys as sys
import csv as csv
from order import Order
from metrics import Metrics
... | unlicense |
jhillairet/ICRH | WEST_design/plot_limitations.py | 2 | 3293 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 21:39:58 2015
In this script we plot the maximum coupled power limits vs coupling resistance.
The limitations come from the maximum current permitted in capacitors and the
maximum voltage. In fact, all the limits are due to the current limits only.
@author: hash
"""... | mit |
danielforsyth/keras | tests/manual/check_callbacks.py | 82 | 7540 | import numpy as np
import random
import theano
from keras.models import Sequential
from keras.callbacks import Callback
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.regularizers import l2
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.utils import np_utils... | mit |
Hezi-Resheff/location-based-behav | loc-vs-acc/location/tables.py | 1 | 4881 | import pandas as pd
import numpy as np
import os
from location import trajectory_processor
from settings import DATA_ROOT
def compare_behav_types(data_file, min_sampels=2000, r=1, hard_max=3):
path = os.path.join(DATA_ROOT, data_file)
animal_data = pd.DataFrame.from_csv(path, parse_dates=["stamp"])
... | mit |
mrcslws/htmresearch | htmresearch/algorithms/sparse_net.py | 12 | 16191 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
ananthamurthy/eyeBlinkBehaviour | analysis/analyze_mouse_performance.py | 2 | 5547 | """analyze_dir.py:
Analyze a given directory. All trials are accumulated and plotted.
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2016, Dilawar Singh "
__credits__ = ["NCBS Bangalore"]
__license__ = "GNU GPL"
__version__ = "1.0.0"
__maintainer__ ... | gpl-3.0 |
lthurlow/Boolean-Constrained-Routing | networkx-1.8.1/build/lib.linux-i686-2.7/networkx/readwrite/tests/test_gml.py | 35 | 3099 | #!/usr/bin/env python
import io
from nose.tools import *
from nose import SkipTest
import networkx
class TestGraph(object):
@classmethod
def setupClass(cls):
global pyparsing
try:
import pyparsing
except ImportError:
try:
import matplotlib.pyparsi... | mit |
mhue/scikit-learn | sklearn/qda.py | 140 | 7682 | """
Quadratic Discriminant Analysis
"""
# Author: Matthieu Perrot <matthieu.perrot@gmail.com>
#
# License: BSD 3 clause
import warnings
import numpy as np
from .base import BaseEstimator, ClassifierMixin
from .externals.six.moves import xrange
from .utils import check_array, check_X_y
from .utils.validation import ... | bsd-3-clause |
calico/basenji | bin/basenji_sat_bed.py | 1 | 13595 | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
B3AU/waveTree | sklearn/linear_model/tests/test_sgd.py | 5 | 29311 | import pickle
import unittest
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing ... | bsd-3-clause |
zorroblue/scikit-learn | sklearn/tests/test_cross_validation.py | 79 | 47914 | """Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse import csr_matrix
from scipy import stats
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
ratnania/pigasus | python/gallery/poisson_nonlin.py | 1 | 10940 | # -*- coding: UTF-8 -*-
#! /usr/bin/python
import sys
import numpy as np
from scipy.sparse.linalg import spsolve
from .poisson import *
from pigasus.fem.basicPDE import *
from numpy import abs
__all__ = ['poisson_picard', 'poisson_newton']
class poisson_picard(poisson):
"""
A multidimentional nonlinear Poiss... | mit |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/pandas/core/computation/pytables.py | 7 | 18930 | """ manage PyTables query interface via Expressions """
import ast
from functools import partial
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import is_list_like
import pandas.core.common as com
from pandas.compat import u, string_types, DeepChainMap
from pandas.core.base import StringMixin
f... | mit |
larsmans/seqlearn | seqlearn/_decode/tests/test_decode.py | 5 | 2198 | from nose.tools import assert_greater
from numpy.testing import assert_array_equal
import numpy as np
from sklearn.metrics import accuracy_score
from seqlearn._decode import bestfirst, viterbi
def test_wikipedia_example():
# HMM example taken from Wikipedia. Samples can be "normal", "cold" or
# "dizzy" (rep... | mit |
TonySheh/losslessh264 | plot_prior_misses.py | 40 | 1124 | # Run h264dec on a single file compiled with PRIOR_STATS and then run this script
# Outputs timeseries plot at /tmp/misses.pdf
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import os
def temporal_misses(key):
values = data[key]
numbins = 100
binsize = len(values) // n... | bsd-2-clause |
robbymeals/scikit-learn | sklearn/calibration.py | 137 | 18876 | """Calibration of predicted probabilities."""
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Balazs Kegl <balazs.kegl@gmail.com>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Mathieu Blondel <mathieu@mblondel.org>
#
# License: BSD 3 clause
from __future__ impo... | bsd-3-clause |
mxjl620/scikit-learn | sklearn/datasets/species_distributions.py | 198 | 7923 | """
=============================
Species distribution dataset
=============================
This dataset represents the geographic distribution of species.
The dataset is provided by Phillips et. al. (2006).
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_... | bsd-3-clause |
robin-lai/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
CodingCat/mxnet | example/kaggle-ndsb1/gen_img_list.py | 42 | 7000 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
linii/ling229-final | topic_modeling/pos_tag_selftext.py | 1 | 1060 | #!/usr/bin/python
import sys
import pickle
import pandas as pan
from nltk import pos_tag, word_tokenize
def add_pos_tags_to_english_docs(docs):
output = []
for doc in docs:
if not (type(doc) is str):
output.append([])
continue
sys.stdout.write("*")
... | gpl-3.0 |
creyesp/RF_Estimation | Clustering/helpers/processClusters/drawClustersGrill.py | 4 | 8022 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# drawClustersGrill.py
# Mónica Otero
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... | gpl-2.0 |
mblondel/scikit-learn | examples/linear_model/plot_lasso_coordinate_descent_path.py | 254 | 2639 | """
=====================
Lasso and Elastic Net
=====================
Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.
The coefficients can be forced to be positive.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import num... | bsd-3-clause |
michaelneuder/image_quality_analysis | bin/nets/wip/ms_ssim_nets/iqa_tools.py | 2 | 12596 | #!/usr/bin/env python3
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import pandas as pd
import numpy as np
import time
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def normalize_input(train_data, test_data):
'''
input: two image sets (1 training, 1 test)
... | mit |
hadim/spindle_tracker | spindle_tracker/tracker/solver/by_frame_solver.py | 1 | 9174 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import logging
log = logging.getLogger(__name__)
import numpy as np
from ...utils import print_progress
from ..matrix import CostMatrix
from .... | bsd-3-clause |
pastephens/pysal | pysal/contrib/pdio/dbf.py | 7 | 6661 | """miscellaneous file manipulation utilities
"""
import numpy as np
import pysal as ps
import pandas as pd
def check_dups(li):
"""checks duplicates in list of ID values
ID values must be read in as a list
__author__ = "Luc Anselin <luc.anselin@asu.edu> "
Arguments
---------
... | bsd-3-clause |
nrhine1/scikit-learn | sklearn/utils/metaestimators.py | 283 | 2353 | """Utilities for meta-estimators"""
# Author: Joel Nothman
# Andreas Mueller
# Licence: BSD
from operator import attrgetter
from functools import update_wrapper
__all__ = ['if_delegate_has_method']
class _IffHasAttrDescriptor(object):
"""Implements a conditional property using the descriptor protocol.
... | bsd-3-clause |
eaplatanios/tensorflow | tensorflow/python/estimator/canned/baseline_test.py | 11 | 54918 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
rwuilbercq/Hive | Example3_EvolveAPainting.py | 1 | 5456 | #!/usr/bin/env python
# ---- MODULE DOCSTRING
__doc__ = """
(C) Hive, Romain Wuilbercq, 2017
_
/_/_ .'''.
=O(_)))) ...' `.
\_\ `. .'''X
`..'
.---. .---..-./`) ,---. ,---. .-''-.
| | |_ _|\ .-.')| / | | .'_ _ \
| | ( ' )/ `-' \| | | .'... | mit |
foreversand/QSTK | Bin/Data_CSV.py | 5 | 3301 | #File to read the data from mysql and push into CSV.
# Python imports
import datetime as dt
import csv
import copy
import os
import pickle
# 3rd party imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# QSTK imports
from QSTK.qstkutil import qsdateutil as du
import QSTK.qstkutil.DataEvol... | bsd-3-clause |
samzhang111/scikit-learn | sklearn/metrics/base.py | 22 | 4802 |
"""
Common code for all metrics
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Arnaud Joly <a.joly@ulg.ac.be>
# Jochen Wersdorfer <jochen@wersdoerfer.de>
# Lars Buitinck... | bsd-3-clause |
hainm/statsmodels | statsmodels/iolib/foreign.py | 25 | 43125 | """
Input/Output tools for working with binary data.
The Stata input tools were originally written by Joe Presbrey as part of PyDTA.
You can find more information here http://presbrey.mit.edu/PyDTA
See also
---------
numpy.lib.io
"""
from statsmodels.compat.python import (zip, lzip, lmap, lrange, string_types, long,... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/matplotlib/transforms.py | 1 | 77073 | """
matplotlib includes a framework for arbitrary geometric
transformations that is used determine the final position of all
elements drawn on the canvas.
Transforms are composed into trees of :class:`TransformNode` objects
whose actual value depends on their children. When the contents of
children change, their pare... | gpl-2.0 |
wangyum/mxnet | example/dec/dec.py | 24 | 7846 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
Hiyorimi/scikit-image | doc/source/conf.py | 5 | 12320 | # -*- coding: utf-8 -*-
#
# skimage documentation build configuration file, created by
# sphinx-quickstart on Sat Aug 22 13:00:30 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | bsd-3-clause |
ilayn/scipy | scipy/ndimage/filters.py | 12 | 55835 | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | bsd-3-clause |
jakevdp/scipy | scipy/spatial/tests/test__plotutils.py | 55 | 1567 | from __future__ import division, print_function, absolute_import
from numpy.testing import dec, assert_, assert_array_equal
try:
import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
has_matplotlib = True
except:
... | bsd-3-clause |
blbarker/spark-tk | regression-tests/sparktkregtests/testcases/models/svm_2d_slope1_test.py | 10 | 3131 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
wilsonkichoi/zipline | zipline/pipeline/loaders/utils.py | 3 | 12108 | import datetime
import numpy as np
import pandas as pd
from six import iteritems
from six.moves import zip
from zipline.utils.numpy_utils import categorical_dtype, NaTns
def next_event_frame(events_by_sid,
dates,
missing_value,
field_dtype,
... | apache-2.0 |
Clyde-fare/scikit-learn | sklearn/utils/graph.py | 289 | 6239 | """
Graph utilities and algorithms
Graphs are represented with their adjacency matrices, preferably using
sparse matrices.
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD 3 clause
impo... | bsd-3-clause |
karasinski/NACAFoil-OpenFOAM | plot.py | 1 | 1969 | #!/usr/bin/env python
"""
This script plots various quantities.
"""
from __future__ import division, print_function
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import argparse
ylabels = {"cl": r"$C_l$", "cd": r"$C_d$", "cl/cd": r"$C_l/C_d$", "k": "$k$",
"omega": r"$\omega$", "eps... | gpl-3.0 |
huzq/scikit-learn | examples/classification/plot_classifier_comparison.py | 34 | 5239 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
Myasuka/scikit-learn | examples/preprocessing/plot_function_transformer.py | 161 | 1949 | """
=========================================================
Using FunctionTransformer to select columns
=========================================================
Shows how to use a function transformer in a pipeline. If you know your
dataset's first principle component is irrelevant for a classification task,
you ca... | bsd-3-clause |
gpetretto/pymatgen | pymatgen/analysis/transition_state.py | 3 | 17253 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import os
import glob
import numpy as np
from monty.json import jsanitize
from monty.json import MSONable
scipy_old_piecewisepolynomial = True
try:
from s... | mit |
shangwuhencc/scikit-learn | sklearn/datasets/tests/test_20news.py | 280 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
xavierwu/scikit-learn | sklearn/ensemble/partial_dependence.py | 251 | 15097 | """Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD 3 clause
from itertools import count
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..externals.joblib import Parallel, delayed
from ..externals im... | bsd-3-clause |
renjinghai/models | autoencoder/MaskingNoiseAutoencoderRunner.py | 10 | 1689 | import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from autoencoder.autoencoder_models.DenoisingAutoencoder import MaskingNoiseAutoencoder
mnist = input_data.read_data_sets('MNIST_data', one_hot = True)
def standard_scale(X_trai... | apache-2.0 |
anjsimmo/simple-ml-pipeline | pipeline/task_traveltime.py | 1 | 1756 | from ruffus import *
import pandas as pd
import numpy as np
import datetime
import datatables.traveltime
import pipeline.data_merged
# Merge all dates into a single file
# X.merged -> traveltime.task
@merge(pipeline.data_merged.merge_data,
'data/traveltime.task')
def task_traveltime(input_files, output_file):
... | mit |
ningchi/scikit-learn | benchmarks/bench_plot_svd.py | 325 | 2899 | """Benchmarks of Singular Value Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from time import time
import numpy as np
from collections import defaultdict
from scipy.linalg import svd
from sklearn.utils.extmath import randomized_svd
from sklearn.datasets.s... | bsd-3-clause |
ktaneishi/deepchem | deepchem/utils/evaluate.py | 1 | 7244 | """
Utility functions to evaluate models on datasets.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import csv
import numpy as np
import warnings
import pandas as pd
import sklearn
from deepchem.utils.save import log
from deepchem.trans import undo_tr... | mit |
dmaticzka/EDeN | eden/util.py | 2 | 8894 | #!/usr/bin/env python
"""Provides utilities for file handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import io
from sklearn.externals import joblib
import requests
import os
import sys
from collections import deque... | mit |
tomlof/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 94 | 10801 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
h2educ/scikit-learn | sklearn/covariance/robust_covariance.py | 198 | 29735 | """
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empir... | bsd-3-clause |
hlin117/statsmodels | statsmodels/tools/tests/test_grouputils.py | 31 | 11494 | import numpy as np
import pandas as pd
from statsmodels.tools.grouputils import Grouping
from statsmodels.tools.tools import categorical
from statsmodels.datasets import grunfeld, anes96
from pandas.util import testing as ptesting
class CheckGrouping(object):
def test_reindex(self):
# smoke test
... | bsd-3-clause |
neale/CS-program | 434-MachineLearning/final_project/linearClassifier/sklearn/cluster/tests/test_spectral.py | 72 | 7950 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | unlicense |
gobiiproject/GOBii-System | gobiiscripts/extractors/HapmapExtractor.py | 1 | 5351 | #!/usr/bin/env python
# encoding: utf-8
'''
edu.cornell.gobii.HapmapExtractor -- shortdesc
edu.cornell.gobii.HapmapExtractor is a description
It defines classes_and_methods
@author: yn259
@copyright: 2016 Cornell University. All rights reserved.
@license: license
@contact: yn259@cornell.edu
@deffield ... | mit |
yandex/rep | rep/estimators/_tmvaFactory.py | 1 | 3221 | """
Supplementary script to train a TMVA estimator.
"""
from __future__ import division, print_function, absolute_import
import sys
import os
import numpy
import pandas
from root_numpy.tmva import add_classification_events, add_regression_events
import ROOT
from . import tmva
import six
from six.moves import cPickle... | apache-2.0 |
JohnVinyard/zounds | zounds/ui/training_monitor.py | 1 | 7083 | from io import BytesIO
from .api import ZoundsApp
import tornado.websocket
import tornado.web
import json
from collections import defaultdict
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
class TrainingMonitorApp(ZoundsApp):
def __init__(
self,
trainer,
... | mit |
datasnakes/Datasnakes-Scripts | examples/standalone-scripts/mygene2csv.py | 1 | 1316 | #!/usr/bin/env python
"""This script is designed to generate some basic gene information from a csv
file of refseqrna accession numbers for human genes."""
import argparse
import textwrap
from OrthoEvol.Tools.mygene import MyGene
def main(infile, outfile):
"""Use MyGene to generate basic gene information.
... | mit |
joshloyal/scikit-learn | examples/decomposition/plot_pca_vs_fa_model_selection.py | 70 | 4523 | """
===============================================================
Model selection with Probabilistic PCA and Factor Analysis (FA)
===============================================================
Probabilistic PCA and Factor Analysis are probabilistic models.
The consequence is that the likelihood of new data can be u... | bsd-3-clause |
jigargandhi/UdemyMachineLearning | Machine Learning A-Z Template Folder/Part 9 - Dimensionality Reduction/Section 44 - Linear Discriminant Analysis (LDA)/lda.py | 5 | 2836 | # LDA
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Wine.csv')
X = dataset.iloc[:, 0:13].values
y = dataset.iloc[:, 13].values
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection impo... | mit |
CVML/scikit-learn | examples/linear_model/plot_theilsen.py | 232 | 3615 | """
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | bsd-3-clause |
bundgus/python-playground | matplotlib-playground/examples/widgets/menu.py | 1 | 4958 | from __future__ import division, print_function
import numpy as np
import matplotlib
import matplotlib.colors as colors
import matplotlib.patches as patches
import matplotlib.mathtext as mathtext
import matplotlib.pyplot as plt
import matplotlib.artist as artist
import matplotlib.image as image
class ItemProperties(o... | mit |
datachand/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_weights_var_impGBM.py | 4 | 6135 | import sys
sys.path.insert(1, "../../../")
import h2o, tests
import random
def weights_var_imp():
def check_same(data1, data2, min_rows_scale):
gbm1_regression = h2o.gbm(x=data1[["displacement", "power", "weight", "acceleration", "year"]],
y=data1["economy"],
... | apache-2.0 |
mlperf/training_results_v0.7 | DellEMC/benchmarks/ssd/implementation/mxnet/tests/generate_report.py | 1 | 5957 | #!/usr/bin/env python
import os
import re
import argparse
from glob import glob
import collections
import git
import numpy as np
import pandas as pd
from jinja2 import Template
import plotly
import plotly.express as px
import plotly.graph_objects as go
try:
git_sha = git.Repo(search_parent_directories=True).hea... | apache-2.0 |
rtb1c13/scripts | Fields/plots.py | 1 | 2621 | #!/usr/bin/env python
# Matplotlib histogram of fields
import numpy as np
import scipy.stats as stats
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-f","--files",help="Files for fields at ... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.