repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
dsullivan7/scikit-learn
sklearn/metrics/cluster/supervised.py
21
26876
"""Utilities to evaluate the clustering performance of models Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # License: BSD 3 clause fr...
bsd-3-clause
florisvb/FlyPlumeTracking
plot_fly_trajectory.py
1
3152
# (c) 2013 Floris van Breugel # # This script is programmed to read a file, "sim_data.pickle," created by the simulation "fly_plume_sim.py," and make the corresponding figure/animation. # The code relies on plotting packages that are freely available from https://github.com/florisvb import pickle import fly_plot_lib....
gpl-3.0
algorithmic-music-exploration/amen
tests/test_synthesize.py
1
2488
#!/usr/bin/env python # -*- coding: utf-8 -*- import six import pandas as pd import numpy as np import librosa import pytest from amen.audio import Audio from amen.utils import example_audio_file from amen.utils import example_mono_audio_file from amen.synthesize import _format_inputs from amen.synthesize import synth...
bsd-2-clause
adamgreenhall/scikit-learn
examples/ensemble/plot_forest_importances_faces.py
403
1519
""" ================================================= Pixel importances with a parallel forest of trees ================================================= This example shows the use of forests of trees to evaluate the importance of the pixels in an image classification task (faces). The hotter the pixel, the more impor...
bsd-3-clause
GehenHe/Recognize-Face-on-Android
tensorflow/contrib/learn/python/learn/dataframe/dataframe.py
85
4704
# 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 applica...
apache-2.0
aktech/sympy
sympy/interactive/tests/test_ipythonprinting.py
24
6208
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module from sympy.utilities.pytest import raises # run_cell was added in IPython 0.11 ipython = import_module("IPython", min_module_version="0.11") # disable ...
bsd-3-clause
shahankhatch/scikit-learn
examples/covariance/plot_mahalanobis_distances.py
348
6232
r""" ================================================================ Robust covariance estimation and Mahalanobis distances relevance ================================================================ An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed data. For Gaussian dis...
bsd-3-clause
lbishal/scikit-learn
examples/semi_supervised/plot_label_propagation_structure.py
45
2433
""" ============================================== Label Propagation learning a complex structure ============================================== Example of LabelPropagation learning a complex internal structure to demonstrate "manifold learning". The outer circle should be labeled "red" and the inner circle "blue". Be...
bsd-3-clause
cogmission/nupic.research
projects/sequence_prediction/continuous_sequence/data/processSineWave.py
13
2231
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, 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
nithyanandan/PRISim
scripts/run_prisim.py
1
122758
#!python import os, shutil, subprocess, pwd, errno, warnings from mpi4py import MPI import yaml import h5py import argparse import copy import numpy as NP from astropy.io import fits, ascii from astropy.coordinates import Galactic, FK5, ICRS, SkyCoord, AltAz, EarthLocation from astropy import units as U from astropy.t...
mit
leylabmpi/leylab_pipelines
leylab_pipelines/DB/TaxID2LinTbl.py
1
9181
# import ## batteries import re import os import sys import gzip import tempfile import multiprocessing import argparse import logging import urllib import tarfile ## 3rd party import pandas as pd ## package from leylab_pipelines import Utils # logging logging.basicConfig( level=logging.DEBUG, format='%(asctime)s...
mit
dancingdan/tensorflow
tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py
30
40476
# 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
neurodroid/sima
examples/spikeinference.py
6
4351
from __future__ import division from __future__ import print_function from builtins import str from builtins import range from scipy import signal from scipy.stats import uniform, norm import numpy as np import seaborn as sns import matplotlib.mlab as ml import matplotlib.pyplot as plt from sima import spikes ######...
gpl-2.0
BalticPinguin/libmesh
doc/statistics/github_traffic_base.py
5
6343
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np import math # Import stuff for working with dates from datetime import datetime from matplotlib.dates import date2num, num2date import calendar # Github has a "traffic" page now, but it doesn't seem like you can # put in an arbitrary date range?...
lgpl-2.1
joshgabriel/dft-crossfilter
CompleteApp/crossfilter_app/main.py
1
25701
import os from os.path import dirname, join from collections import OrderedDict import pandas as pd import numpy as np import json from bokeh.io import curdoc from bokeh.layouts import row, widgetbox, column, gridplot, layout from bokeh.models import Select, Div, Column, \ HoverTool, ColumnDataSource, Button, RadioB...
mit
CERT-Solucom/certitude
crossbokeh.py
2
8483
import pandas as pd import io from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from config import CERTITUDE_DATABASE, LISTEN_ADDRESS, LISTEN_PORT from helpers.queue_models import Task from helpers.results_models import Result, IOCDetection from helpers.misc_models import ConfigurationProfi...
gpl-2.0
jrderuiter/genemap
src/genemap/mappers/base.py
1
4608
# -*- coding: utf-8 -*- # pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import from __future__ import absolute_import, division, print_function from builtins import * # pylint: enable=wildcard-import,redefined-builtin,unused-wildcard-import import pandas as pd from . import util _registry = {} _...
mit
samzhang111/scikit-learn
sklearn/naive_bayes.py
11
28770
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
chenkianwee/envuo
setup.py
1
1430
from setuptools import setup, find_packages __author__ = "CHEN Kian Wee" __copyright__ = "Copyright 2016, Chen Kian Wee" __credits__ = ["CHEN Kian Wee"] __license__ = "GPL3" __version__ = "0.32" __maintainer__ = "Chen Kian Wee" __email__ = "chenkianwee@gmail.com" __status__ = "Development" LONG_DESCRIPTION = "refer t...
gpl-3.0
powerjg/gem5-ci-test
util/dram_lat_mem_rd_plot.py
10
5156
#!/usr/bin/env python2 # Copyright (c) 2015 ARM Limited # All rights reserved # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementatio...
bsd-3-clause
potash/scikit-learn
examples/cluster/plot_segmentation_toy.py
91
3522
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
nextgis-borsch/borsch
opt/tools.py
1
25068
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ ## ## Project: NextGIS Borsch build system ## Purpose: Various tools ## Author: Dmitry Baryshnikov <dmitry.baryshnikov@nextgis.com> ## Author: Maxim Dubinin <maim.dubinin@nextgis.com> ## Copyri...
gpl-2.0
ninotoshi/tensorflow
tensorflow/python/client/notebook.py
26
4596
# Copyright 2015 Google Inc. 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 applicable law or a...
apache-2.0
RohitMetaCube/test_code
MakeMyTrip/train_model.py
1
4961
# -*- coding: utf-8 -*- import os import random from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.linear_model import SGDClassifier import numpy as np from sklearn.decomposition import TruncatedSVD ...
gpl-3.0
mlperf/training_results_v0.5
v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/models/official/utils/data/file_io.py
4
7242
# Copyright 2018 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
lin-credible/scikit-learn
examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
286
2378
""" ===================================================================== Decision boundary of label propagation versus SVM on the Iris dataset ===================================================================== Comparison for decision boundary generated on iris dataset between Label Propagation and SVM. This demon...
bsd-3-clause
minireference/noBSLAnotebooks
aspynb/Linear_algebra_chapters_overview.py
1
23478
def cells(): ''' # Linear algebra overview ''' ''' ''' ''' Linear algebra is the study of **vectors** and **linear transformations**. This notebook introduces concepts form linear algebra in a birds-eye overview. The goal is not to get into the details, but to give the reader a taste of th...
mit
wateraccounting/wa
Collect/MYD13/DataAccess.py
2
15226
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- """ Authors: Tim Hessels UNESCO-IHE 2016 Contact: t.hessels@unesco-ihe.org Repository: https://github.com/wateraccounting/wa Module: Collect/MOD13 """ # import general python modules import os import numpy as np import pandas as pd import gdal import urllib impo...
apache-2.0
NeuroanatomyAndConnectivity/pipelines
src/clustering/clustering/cons_cluster.py
2
2675
import os from nipype.interfaces.base import BaseInterface, \ BaseInterfaceInputSpec, traits, File, TraitedSpec from nipype.utils.filemanip import split_filename from sklearn.cluster import spectral_clustering as spectral from sklearn.cluster import KMeans as km from sklearn.cluster import Ward from sklearn.cluste...
mit
datapythonista/pandas
pandas/tests/indexes/multi/test_setops.py
1
16895
import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, Index, IntervalIndex, MultiIndex, Series, ) import pandas._testing as tm @pytest.mark.parametrize("case", [0.5, "xxx"]) @pytest.mark.parametrize( "method", ["intersection", "union", "difference", "symm...
bsd-3-clause
numenta/htmresearch
projects/energy_based_pooling/energy_based_models/utils.py
7
2554
# ---------------------------------------------------------------------- # 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
bbfamily/abu
abupy/TradeBu/ABuMLFeature.py
1
33599
# -*- encoding:utf-8 -*- """ 内置特征定义,以及用户特征扩展,定义模块 """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import ast import datetime import os import numpy as np from ..CoreBu import ABuEnv # noinspection PyUnresolvedReferences from ..CoreBu.ABuFixes impo...
gpl-3.0
shangwuhencc/shogun
examples/undocumented/python_modular/graphical/group_lasso.py
26
7792
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from numpy.random import rand, randn, permutation, multivariate_normal from modshogun import BinaryLabels, RealFeatures, IndexBlock, IndexBlockGroup, FeatureBlockLogisticRegression def generate_synthetic_logistic_data(n, p, L, blk_nnz, gcov, nstd)...
gpl-3.0
LiaoPan/scikit-learn
examples/neural_networks/plot_rbm_logistic_classification.py
258
4609
""" ============================================================== Restricted Boltzmann Machine features for digit classification ============================================================== For greyscale image data where pixel values can be interpreted as degrees of blackness on a white background, like handwritten...
bsd-3-clause
leofdecarvalho/MachineLearning
9. Artificial_Neural_Networks/evaluating_improving_tuning.py
5
5048
# Artificial Neural Network # Installing Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow # pip install tensorflow # Installing Keras # pip install --upgrade keras # Part 1 - Data Preprocessing # Importing the libraries import numpy as np import matplotlib.pyp...
mit
olafhauk/mne-python
mne/utils/__init__.py
4
4476
# # # WARNING # # # # This list must also be updated in doc/_templates/autosummary/class.rst if it # is changed here! _doc_special_members = ('__contains__', '__getitem__', '__iter__', '__len__', '__add__', '__sub__', '__mul__', '__div__', '__neg__', '__hash__') from ._b...
bsd-3-clause
ZwEin27/digoie-annotation
digoie/core/ml/dataset/vector.py
1
3874
import re import os from sklearn.feature_extraction.text import CountVectorizer from digoie.conf.storage import __root_dir__, __ml_datasets_dir__ from digoie.utils.symbols import do_newline_symbol from operator import itemgetter import numpy as np def vectorize(raw, my_min_df=0.0005, my_max_df=0.5, update_feature_...
mit
elkingtonmcb/scikit-learn
sklearn/feature_selection/variance_threshold.py
238
2594
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: 3-clause BSD import numpy as np from ..base import BaseEstimator from .base import SelectorMixin from ..utils import check_array from ..utils.sparsefuncs import mean_variance_axis from ..utils.validation import check_is_fitted class VarianceThreshold(BaseEstim...
bsd-3-clause
equialgo/scikit-learn
sklearn/linear_model/setup.py
83
1719
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
mrustl/flopy
autotest/t020_test.py
1
4369
# Test modflow write adn run import numpy as np def analyticalWaterTableSolution(h1, h2, z, R, K, L, x): h = np.zeros((x.shape[0]), np.float) b1 = h1 - z b2 = h2 - z h = np.sqrt(b1 ** 2 - (x / L) * (b1 ** 2 - b2 ** 2) + (R * x / K) * (L - x)) + z return h def test_mfnwt_run(): import os ...
bsd-3-clause
all-umass/ller
demo.py
1
1074
from ller import LLER, LocallyLinearEmbedding from mpl_toolkits.mplot3d import Axes3D from optparse import OptionParser from sklearn.datasets import make_swiss_roll import matplotlib.pyplot as plt def demo(k): X, t = make_swiss_roll(noise=1) lle = LocallyLinearEmbedding(n_components=2, n_neighbors=k) lle...
bsd-3-clause
micahhausler/pandashells
pandashells/bin/p_example_data.py
8
2130
#! /usr/bin/env python # standard library imports import os import sys # noqa import argparse import textwrap import pandashells def main(): # create a dict of data-set names and corresponding files package_dir = os.path.dirname(os.path.realpath(pandashells.__file__)) sample_data_dir = os.path.realpath...
bsd-2-clause
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/io/tests/sas/test_xport.py
1
4258
import pandas as pd import pandas.util.testing as tm from pandas.io.sas.sasreader import read_sas import numpy as np import os # CSV versions of test xpt files were obtained using the R foreign library # Numbers in a SAS xport file are always float64, so need to convert # before making comparisons. def numeric_as_f...
mit
marcocaccin/scikit-learn
sklearn/datasets/base.py
6
22957
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import sys import shutil from os import environ...
bsd-3-clause
leonardbinet/Transilien-Api
api_etl/builder_feature_matrix.py
2
35646
"""Module containing class to build feature matrices for prediction. There are two kinds of features: - either features for direct prediction model - either features for recursive prediction model Only the first one is used for now. """ from os import path, makedirs import logging from datetime import datetime, tim...
mit
alex314159/bondpricer
BondDataModel.py
1
29284
""" Bond pricer - displays data from Bloomberg and Front, MVC architecture. Written by Alexandre Almosni alexandre.almosni@gmail.com (C) 2014-2017 Alexandre Almosni Released under Apache 2.0 license. More info at http://www.apache.org/licenses/LICENSE-2.0 Classes: MessageContainer: simple wrapper RFDdata: us...
apache-2.0
potash/scikit-learn
examples/mixture/plot_concentration_prior.py
25
5631
""" ======================================================================== Concentration Prior Type Analysis of Variation Bayesian Gaussian Mixture ======================================================================== This example plots the ellipsoids obtained from a toy dataset (mixture of three Gaussians) fitte...
bsd-3-clause
fyffyt/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/lib/mpl_examples/pylab_examples/trigradient_demo.py
7
3075
""" Demonstrates computation of gradient with matplotlib.tri.CubicTriInterpolator. """ from matplotlib.tri import Triangulation, UniformTriRefiner,\ CubicTriInterpolator import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import math #-----------------------------------------------------...
mit
tracek/Ornithokrites
features.py
1
6464
# -*- coding: utf-8 -*- """ Created on Mon Dec 02 12:07:49 2013 @author: ltracews """ import os import sys import itertools import numpy as np import matplotlib.pyplot as plt import yaafelib class FeatureExtractor(object): def __init__(self, app_config, rate): self.ExtractedFeaturesList = ['LPC1_mean',...
gpl-3.0
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/ex_4/extra_functions.py
1
2040
import numpy as np import cv2 import matplotlib.image as mpimg def perspect_transform(img, src, dst): # Get transform matrix using cv2.getPerspectivTransform() M = cv2.getPerspectiveTransform(src, dst) # Warp image using cv2.warpPerspective() # keep same size as input image warped = cv2.warpPersp...
mit
pcmoritz/arrow
python/pyarrow/tests/test_feather.py
2
17854
# 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
thunderhoser/GewitterGefahr
gewittergefahr/prediction_paper_2019/make_detection_figure.py
1
16649
"""Makes figure to explain storm detection.""" import argparse import numpy import matplotlib matplotlib.use('agg') import matplotlib.pyplot as pyplot from gewittergefahr.gg_io import myrorss_and_mrms_io from gewittergefahr.gg_io import storm_tracking_io as tracking_io from gewittergefahr.gg_utils import time_conversi...
mit
ElricleNecro/LibThese
scripts/animationv2.py
1
1156
#! /usr/bin/env python3 # -*- coding:Utf8 -*- import os import sys import logging as log import importlib import matplotlib as ml ml.use('agg') import LibThese.Plot.Animation as lpa from LibThese.Plot import Animate as an PREFIX = os.path.dirname(__file__) PLUGINS_DIR = os.path.abspath( os.path.join( PR...
lgpl-3.0
impactlab/eemeter
tests/structures/test_energy_trace.py
1
4624
from eemeter.structures import EnergyTrace from eemeter.io.serializers import ArbitrarySerializer import pandas as pd import numpy as np from datetime import datetime import pytz import pytest @pytest.fixture def interpretation(): return 'ELECTRICITY_CONSUMPTION_SUPPLIED' def test_no_data_no_placeholder(interp...
mit
nikitasingh981/scikit-learn
examples/neural_networks/plot_mlp_alpha.py
58
4088
""" ================================================ Varying regularization in Multi-layer Perceptron ================================================ A comparison of different values for regularization parameter 'alpha' on synthetic datasets. The plot shows that different alphas yield different decision functions. A...
bsd-3-clause
Cyberface/nrutils_dev
review/notebooks/check-strain.py
1
1492
''' The goal of this script is to compare the output of nrutils' strain calculation method to the output of an independent MATLAB code of the same method. For convinience, ascii data for the MATLAB routine's output is saved within this repository. -- lionel.london@ligo.org 2016 -- ''' # Import useful things from os.pa...
mit
dhwang99/statistics_introduction
bayes_estimate/ex2.py
1
3051
#encoding: utf8 import numpy as np from scipy.stats import norm import matplotlib.pyplot as plt import pdb ''' X1, X2..., Xn ~ N(mu, 1) a. simulate a data set (using mu=5) consisting 100 observations b. take f(mu)=1 and find the posterior desity. plot it c. simulate 1000 draws from the posterior. Plot a histogram...
gpl-3.0
amarszalek/PyOrderedFuzzyTools
pyorderedfuzzy/ofmodels/ofgarch.py
1
2859
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from pyorderedfuzzy.ofnumbers.ofnumber import OFNumber from pyorderedfuzzy.ofmodels.ofseries import OFSeries from arch import arch_model __author__ = "amarszalek" class OFGARCH(object): def __init__(self): super(OFGARCH, self).__init__() ...
mit
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/tests/io/json/test_json_table_schema.py
9
18572
"""Tests for Table Schema integration.""" import json from collections import OrderedDict import numpy as np import pandas as pd import pytest from pandas import DataFrame from pandas.core.dtypes.dtypes import ( PeriodDtype, CategoricalDtype, DatetimeTZDtype) from pandas.io.json.table_schema import ( as_json_...
mit
supernifty/mgsa
mgsa/generate_all_reports.py
1
131319
# # build the charts used in the final report # generally these assume the analysis has been done; the command to do this is included in the function # import collections import datetime import math import os import re import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import pylab import sys ...
mit
ThinkOpen-Solutions/odoo
addons/resource/faces/timescale.py
170
3902
############################################################################ # Copyright (C) 2005 by Reithinger GmbH # mreithinger@web.de # # This file is part of faces. # # faces is free software; you can redistribute it and/or modify # ...
agpl-3.0
ngoix/OCRF
sklearn/naive_bayes.py
5
28895
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
dgies/incubator-airflow
airflow/contrib/hooks/bigquery_hook.py
9
38929
# -*- coding: utf-8 -*- # # 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, software ...
apache-2.0
ScottHull/Exoplanet-Pocketknife
old/strip_hefesto2.py
1
1637
import os import pandas as pd if __name__ == "__main__": print("In what directory shall we parse?") to_dir = input(">>> ") for root, dirs, files in os.walk(os.getcwd() + "/" + to_dir, topdown=False): operating_dir = root if "fort.58" in str(root): if "strip_hefe...
cc0-1.0
tdhopper/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
267
6813
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
HeraclesHX/scikit-learn
examples/gaussian_process/gp_diabetes_dataset.py
223
1976
#!/usr/bin/python # -*- coding: utf-8 -*- """ ======================================================================== Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset ======================================================================== In this example, we fit a Gaussian Process model onto...
bsd-3-clause
nanophotonics/nplab
nplab/analysis/calculate_MPEs.py
1
3595
# -*- coding: utf-8 -*- """ Created on Wed May 23 16:51:45 2018 @author: wmd22 A few functions for quick calculation ofs MPE's """ from __future__ import division from past.utils import old_div import matplotlib #%matplotlib inline import matplotlib.pyplot as plt import numpy as np #,average_power, rep_rate = 80E6,...
gpl-3.0
CospanDesign/python
image_processor/opencv_harris_test.py
1
1036
#! /usr/bin/env python import cv2 import numpy as np import matplotlib.pyplot as plt from image_processor import * print (TCOLORS.PURPLE + "OpenCV Harris Corner Detector" + TCOLORS.NORMAL) try: filename = FILENAME except NameError: #filename = 'chessboard.png' #filename = 'chessboard.jpg' filename ...
mit
TNT-Samuel/Coding-Projects
DNS Server/Source - Copy/Lib/site-packages/dask/dataframe/io/json.py
5
6650
from __future__ import absolute_import import io import pandas as pd from dask.bytes import open_files, read_bytes import dask def to_json(df, url_path, orient='records', lines=None, storage_options=None, compute=True, encoding='utf-8', errors='strict', compression=None, **kwargs): """Wri...
gpl-3.0
phobson/statsmodels
examples/python/ols.py
30
5601
## Ordinary Least Squares from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std np.random.seed(9876789) # ## OLS estimation # # Artificial data: nsample = 100 x = np.linspace(0, 1...
bsd-3-clause
huobaowangxi/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
MartinDelzant/scikit-learn
examples/cluster/plot_cluster_comparison.py
246
4684
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
bsd-3-clause
botswana-harvard/microbiome
export/export_model.py
1
2281
import os import pandas as pd from datetime import date from edc_model_to_dataframe import EdcModelToDataFrame class ExportModel: def __init__(self, model, consent_model, visit_lookup=None): self.add_columns_for = visit_lookup or 'registered_subject' self.visit_lookup = visit_lookup sel...
gpl-2.0
rew4332/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py
4
2327
# Copyright 2016 Google Inc. 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 applicable law or a...
apache-2.0
ashhher3/scikit-learn
sklearn/covariance/tests/test_graph_lasso.py
37
2901
""" Test the graph_lasso module. """ import sys import numpy as np from scipy import linalg from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_less from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV, empirical_...
bsd-3-clause
mattgiguere/scikit-learn
sklearn/manifold/t_sne.py
8
20008
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # License: BSD 3 clause (C) 2014 # This is the standard t-SNE implementation. There are faster modifications of # the algorithm: # * Barnes-Hut-SNE: reduces the complexity of the gradient computation from # N^2 to N log N (http://arxiv.org/abs/1301....
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_toolkits/axes_grid1/axes_rgb.py
7
4658
import numpy as np from axes_divider import make_axes_locatable, Size, locatable_axes_factory def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True): """ pad : fraction of the axes height. """ divider = make_axes_locatable(ax) pad_size = Size.Fraction(pad, Size.AxesY(ax)) xsize = Siz...
mit
njchiang/task-fmri-utils
fmri_core/rsa.py
1
15154
from scipy.stats import wilcoxon # , spearmanr <- this has a bug from scipy.spatial.distance import pdist, squareform from sklearn.model_selection import LeaveOneOut from scipy.stats import mstats_basic from scipy.stats import rankdata, distributions import numpy as np import warnings from .utils import write_to_logge...
mit
jblupus/PyLoyaltyProject
ccdf/ccdf.py
1
3062
from collections import Counter import json import math import numpy as np import pandas as pd def get_language_data(): df = pd.read_csv('../data/profile/users_profile_data.csv') df['language'] = map(lambda lang: 'en' if 'en-' in lang else lang, df['language']) df['language'] = map(lambda lang: 'es' if ...
bsd-2-clause
liyu1990/sklearn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
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
cin/spark
python/pyspark/sql/functions.py
1
85981
# # 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 us...
apache-2.0
nmih/ssbio
ssbio/pipeline/atlas2.py
2
68022
import logging import os import os.path as op import sys import cobra.flux_analysis import cobra.manipulation import numpy as np import pandas as pd from Bio import SeqIO from cobra.core import DictList import json import ssbio.core.modelpro import ssbio.databases.ncbi import ssbio.databases.patric import ssbio.protei...
mit
beercanlah/flapibrew
runserver.py
1
5566
import tornado.httpserver import tornado.websocket import tornado.ioloop import tornado.web from tornado.wsgi import WSGIContainer import json import numpy as np import pandas as pd import datetime from cStringIO import StringIO from collections import namedtuple from flapibrew import app import matplotlib import mat...
mit
arogozhnikov/OBDT
pruning/_matrixnetapplier.py
2
8855
from __future__ import print_function, division, absolute_import """ This class is used to build predictions of MatrixNet classifier it uses .mx format of MatrixNet formula. """ __author__ = 'Alex Rogozhnikov, Egor Khairullin' import struct import numpy class MatrixnetClassifier(object): def __init__(self, form...
mit
fspaolo/scikit-learn
sklearn/metrics/metrics.py
2
72648
# -*- coding: utf-8 -*- """Utilities to evaluate the predictive performance of models Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandr...
bsd-3-clause
Ziqi-Li/bknqgis
numpy/doc/source/conf.py
2
10015
# -*- coding: utf-8 -*- from __future__ import division, absolute_import, print_function import sys, os, re # Check Sphinx version import sphinx if sphinx.__version__ < "1.2.1": raise RuntimeError("Sphinx 1.2.1 or newer required") needs_sphinx = '1.0' # ----------------------------------------------------------...
gpl-2.0
yohanashima/envelope
horakusen.py
1
1847
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid.axislines import SubplotZero # 図の背景の諸体裁を設定 # 作図スペースを用意(?)。個々のコードの意味がわかりません。 fig = plt.figure(1) ax = SubplotZero(fig, 111) fig.add_subplot(ax) # 軸の設定 ax.axhline(linewidth=1.2, color="black") ax.axvline(linewidth...
gpl-3.0
heprom/pymicro
examples/plotting/radon.py
1
1136
import os, numpy as np from pymicro.file.file_utils import HST_read from skimage.transform import radon from matplotlib import pyplot as plt if __name__ == '__main__': ''' Example of use of the radon transform. ''' data = HST_read('../data/mousse_250x250x250_uint8.raw', autoparse_filename=True, zrange=...
mit
googleinterns/cabby
cabby/data/metagraph/utils.py
1
11492
# coding=utf-8 # Copyright 2020 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 ...
apache-2.0
h2educ/scikit-learn
sklearn/utils/fixes.py
39
13318
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
kevin-intel/scikit-learn
examples/kernel_approximation/plot_scalable_poly_kernels.py
15
7266
""" ======================================================= Scalable learning with polynomial kernel aproximation ======================================================= This example illustrates the use of :class:`PolynomialCountSketch` to efficiently generate polynomial kernel feature-space approximations. This is us...
bsd-3-clause
takkasila/TwitGeoSpa
province_connection_table.py
1
5080
import sys sys.path.insert(0, './Province') import csv import twit_extract_feature import pandas from provinces import * from user_tracker import * from math import floor class ProvinceTable: def __init__(self, provinces): self.provinces = provinces self.table = [[0 for x in range(len(provinces))] ...
mit
aewhatley/scikit-learn
sklearn/metrics/classification.py
28
67703
"""Metrics to assess performance on classification task given classe prediction Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gram...
bsd-3-clause
ashhher3/seaborn
doc/conf.py
25
9149
# -*- coding: utf-8 -*- # # seaborn documentation build configuration file, created by # sphinx-quickstart on Mon Jul 29 23:25:46 2013. # # 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
AlexanderFabisch/scikit-learn
examples/manifold/plot_mds.py
45
2731
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
marionleborgne/nupic.research
projects/sound_encoder/live_sound_encoding_demo.py
12
2494
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
Caranarq/01_Dmine
99_Descentralizacion/P9901/P9901.py
1
2791
# -*- coding: utf-8 -*- """ Started on thu, jun 21st, 2018 @author: carlos.arana """ # Librerias utilizadas import pandas as pd import sys module_path = r'D:\PCCS\01_Dmine\Scripts' if module_path not in sys.path: sys.path.append(module_path) from VarInt.VarInt import VarInt from classes.Meta import Meta from Comp...
gpl-3.0
florian-wagner/gimli
python/pygimli/viewer/modelview.py
1
5493
# -*- coding: utf-8 -*- """pygimli model viewer functions.""" import matplotlib.pyplot as plt import numpy as np import pygimli as pg from matplotlib.patches import Rectangle # from math import sqrt, floor, ceil def showmymatrix(A, x, y, dx=2, dy=1, xlab=None, ylab=None, cbar=None): """ Pls. insert short...
gpl-3.0
xmnlab/minilab
labtrans/daq/mswim_finite.py
1
3511
# -*- coding: utf-8 -*- """ Created on Tue Oct 8 16:11:48 2013 @author: ivan """ from __future__ import print_function, division from PyDAQmx import * from PyDAQmx.DAQmxFunctions import * from PyDAQmx.DAQmxConstants import * from matplotlib import pyplot as plt import numpy as np import time class AcquisitionFinit...
gpl-3.0