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
eranchetz/nupic
examples/audiostream/audiostream_tp.py
32
9991
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, 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
chenyyx/scikit-learn-doc-zh
examples/en/covariance/plot_outlier_detection.py
15
5121
""" ========================================== Outlier detection with several methods. ========================================== When the amount of contamination is known, this example illustrates three different ways of performing :ref:`outlier_detection`: - based on a robust estimator of covariance, which is assum...
gpl-3.0
jjongbloets/julesTk
julesTk/view/plot.py
1
3049
"""Implement a Frame with a matplotlib""" from julesTk.view import * import matplotlib matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure class PlotFrame(Frame, object): def __init__(self, parent): super(...
mit
jiegzhan/multi-class-text-classification-cnn-rnn
train.py
1
6685
import os import sys import json import time import shutil import pickle import logging import data_helper import numpy as np import pandas as pd import tensorflow as tf from text_cnn_rnn import TextCNNRNN from sklearn.model_selection import train_test_split logging.getLogger().setLevel(logging.INFO) def train_cnn_rn...
apache-2.0
henridwyer/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
57
13752
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
LeeKamentsky/CellProfiler
cellprofiler/modules/measureobjectradialdistribution.py
1
41744
"""<b>Measure Object Radial Distribution</b> measures the radial distribution of intensities within each object. <hr> Given an image with objects identified, this module measures the intensity distribution from each object's center to its boundary within a user-controlled number of bins, i.e. rings. <p>The distribut...
gpl-2.0
heroxbd/SHTOOLS
examples/python/TestLegendre/TestLegendre.py
1
4995
#!/usr/bin/env python """ This script tests and plots all Geodesy normalized Legendre functions. Parameters can be changed in the main function. """ from __future__ import absolute_import, division, print_function import os import sys import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt sys.pat...
bsd-3-clause
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/matplotlib/testing/jpl_units/__init__.py
8
3266
#======================================================================= """ This is a sample set of units for use with testing unit conversion of matplotlib routines. These are used because they use very strict enforcement of unitized data which will test the entire spectrum of how unitized data might be used (it is...
mit
ragnarekker/Ice-modelling
utilities/getregobsdata.py
1
50189
# -*- coding: utf-8 -*- import datetime as dt import requests import os as os import copy as cp from icemodelling import ice as ice, constants as const from utilities import makepickle as mp, makelogs as ml, doconversions as dc from utilities import getmisc as gm import setenvironment as se import pandas as pd __autho...
mit
ppp2006/runbot_number0
qbo_stereo_anaglyph/hrl_lib/src/hrl_lib/matplotlib_util.py
3
8282
# # Copyright (c) 2009, Georgia Tech Research Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, thi...
lgpl-2.1
cloudera/ibis
ibis/backends/clickhouse/tests/test_operators.py
1
7561
import operator from datetime import date, datetime import numpy as np import pandas as pd import pandas.testing as tm import pytest import ibis import ibis.expr.datatypes as dt from ibis import literal as L pytest.importorskip('clickhouse_driver') pytestmark = pytest.mark.clickhouse @pytest.mark.parametrize( ...
apache-2.0
wanggang3333/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
BiaDarkia/scikit-learn
sklearn/manifold/tests/test_mds.py
99
1873
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.manifold import mds from sklearn.utils.testing import assert_raises def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
oferb/OpenTrains
webserver/opentrain/algorithm/django_examples.py
1
1925
import gtfs.models import analysis.models import numpy as np from scipy import spatial import shelve try: import matplotlib.pyplot as plt except ImportError: pass import simplekml import config import itertools import os def print_all(route_id): results = gtfs.models.Trip.objects.filter(route_id=route_id...
bsd-3-clause
LxMLS/lxmls-toolkit
labs/scripts/non_linear_sequence_classifiers/exercise_2.py
1
3448
# coding: utf-8 # ### WSJ Data # In[ ]: # Load Part-of-Speech data from lxmls.readers.pos_corpus import PostagCorpusData data = PostagCorpusData() # ### Check Numpy and Pytorch Gradients match # As we did with the feed-forward network, we will no implement a Recurrent Neural Network (RNN) in Pytorch. For this c...
mit
Openergy/oplus
oplus/output_table.py
1
4492
import os import pandas as pd from oplus.configuration import CONF def to_float_if_possible(s): try: return float(s) except ValueError: if s.strip() == "": return None else: return s class OutputTable: def __init__(self, path): if not os.path.isf...
mpl-2.0
tdhopper/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
yanboliang/spark
python/pyspark/sql/session.py
3
37286
# # 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
mholtrop/Phys605
Python/Getting_Started/CSV_Multi_Plot.py
1
3996
#!/usr/bin/env python # # This example expands on the CSV_Plot.py. It will open all the # csv files that are given on the command line, and plot the data found # in the files in a single plot. # import sys import argparse # import os.path as path import csv import numpy as np # This gives numpy the shorthand np impor...
gpl-3.0
kazemakase/scikit-learn
sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
bsd-3-clause
jwcarr/flatlanders
analysis/plot.py
1
16473
from math import isinf, isnan import matplotlib.pyplot as plt from matplotlib import gridspec import basics # Colour palettes adapted from: # http://wesandersonpalettes.tumblr.com # https://github.com/karthik/wesanderson # https://github.com/jiffyclub/palettable Bottle_Rocket = ["#9B110E", "#3F5151", "#0C1707",...
mit
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/tests/frame/test_join.py
11
5226
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import DataFrame, Index, PeriodIndex from pandas.tests.frame.common import TestData import pandas.util.testing as tm @pytest.fixture def frame_with_period_index(): return DataFrame( data=np.arange(20).reshape(4, 5), columns=lis...
apache-2.0
COHRINT/cops_and_robots
src/cops_and_robots/helpers/visualizations.py
1
3212
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np def plot_multisurface(X, Y, Z, ax, cmaps=None, min_alpha=0.6, **kwargs): num_surfs = Z.shape[2] if cmaps == None: cmaps = ['Greys', 'Reds', 'Purples', 'Oranges', 'Greens', 'Blues', 'RdPu'] ...
apache-2.0
mjgrav2001/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
lukeshingles/artistools
artistools/nonthermal.py
1
13926
#!/usr/bin/env python3 import argparse # import glob import math # import re import multiprocessing import os from collections import namedtuple from functools import lru_cache from pathlib import Path import matplotlib.pyplot as plt import numpy as np # import matplotlib.ticker as ticker import pandas as pd from astr...
mit
sanketloke/scikit-learn
examples/cluster/plot_color_quantization.py
297
3443
# -*- coding: utf-8 -*- """ ================================== Color Quantization using K-Means ================================== Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace (China), reducing the number of colors required to show the image from 96,615 unique colors to 64, while pre...
bsd-3-clause
bert9bert/statsmodels
examples/python/glm.py
5
3979
## Generalized Linear Models from __future__ import print_function import numpy as np import statsmodels.api as sm from scipy import stats from matplotlib import pyplot as plt # ## GLM: Binomial response data # # ### Load data # # In this example, we use the Star98 dataset which was taken with permission # from Je...
bsd-3-clause
CJ-Wright/scikit-beam
doc/sphinxext/tests/test_docscrape.py
12
14257
# -*- encoding:utf-8 -*- import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from docscrape import NumpyDocString, FunctionDoc, ClassDoc from docscrape_sphinx import SphinxDocString, SphinxClassDoc from nose.tools import * doc_txt = '''\ numpy.multivariate_normal(mean, cov, shape=No...
bsd-3-clause
nfoti/StarCluster
utils/scimage_11_10.py
20
15705
#!/usr/bin/env python """ This script is meant to be run inside of a ubuntu cloud image available at uec-images.ubuntu.com:: $ EC2_UBUNTU_IMG_URL=http://uec-images.ubuntu.com/oneiric/current $ wget $EC2_UBUNTU_IMG_URL/oneiric-server-cloudimg-amd64.tar.gz or:: $ wget $EC2_UBUNTU_IMG_URL/oneiric-server-clo...
lgpl-3.0
zkraime/osf.io
scripts/analytics/links.py
55
1227
# -*- coding: utf-8 -*- import os import matplotlib.pyplot as plt from framework.mongo import database from website import settings from .utils import plot_dates, mkdirp link_collection = database['privatelink'] FIG_PATH = os.path.join(settings.ANALYTICS_PATH, 'figs', 'features') mkdirp(FIG_PATH) def analyze_vi...
apache-2.0
justacec/bokeh
bokeh/charts/builders/timeseries_builder.py
6
3925
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the TimeSeries chart, which provides a convenient interface for generating different charts using series-like data by transforming the data to a consistent format and producing renderers. """ # ---------...
bsd-3-clause
stevengt/Degrees-of-Separation
degreesOfSeparation.py
1
3467
"""These methods use SQLite to search an IMDb snapshot to determine the degrees of separation among movies.""" import sqlite3 as sql import sys import Queue import matplotlib.pyplot as plot visitedActors = set() visitedMovies = set() indexByActors = dict() indexByMovies = dict() def graphDegrees(degreesOfSepar...
mit
larsmans/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/io/date_converters.py
10
1827
"""This module is designed for community supported date conversion functions""" from pandas.compat import range, map import numpy as np import pandas._libs.lib as lib def parse_date_time(date_col, time_col): date_col = _maybe_cast(date_col) time_col = _maybe_cast(time_col) return lib.try_parse_date_and_ti...
mit
jbloomlab/phydms
tests/test_omegabysite.py
1
4286
"""Tests ``--omegabysite`` option to ``phydms`` on simulate data. Written by Jesse Bloom. """ import os import unittest import subprocess import random import pandas import phydmslib.file_io import phydmslib.models import phydmslib.simulate from phydmslib.constants import N_NT import pyvolve import numpy class tes...
gpl-3.0
rubikloud/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
liyu1990/sklearn
sklearn/gaussian_process/tests/test_gpc.py
28
6061
"""Testing for Gaussian process classification """ # Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Licence: BSD 3 clause import numpy as np from scipy.optimize import approx_fprime from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF, Constant...
bsd-3-clause
lbdreyer/cartopy
docs/source/conf.py
1
11935
# (C) British Crown Copyright 2011 - 2013, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
lgpl-3.0
Juanlu001/aquagpusph
examples/2D/spheric_testcase9_tld/cMake/plot_m.py
1
6867
#****************************************************************************** # * # * ** * * * * * # * * * * * * * * * * ...
gpl-3.0
astocko/statsmodels
statsmodels/tsa/statespace/sarimax.py
6
80033
""" SARIMAX Model Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function from warnings import warn import numpy as np from .mlemodel import MLEModel, MLEResults from .tools import ( companion_matrix, diff, is_invertible, constrain_stationary_univariate, ...
bsd-3-clause
lcnature/brainiak
tests/funcalign/test_srm.py
4
10913
# Copyright 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 required by applicable law or agreed to...
apache-2.0
jseabold/statsmodels
statsmodels/tsa/filters/hp_filter.py
4
3240
import numpy as np from scipy import sparse from scipy.sparse.linalg import spsolve from statsmodels.tools.validation import array_like, PandasWrapper def hpfilter(x, lamb=1600): """ Hodrick-Prescott filter. Parameters ---------- x : array_like The time series to filter, 1-d. lamb : ...
bsd-3-clause
mrcslws/nupic.research
projects/whydense/mnist/analyze_noise.py
3
5135
# ---------------------------------------------------------------------- # 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 progra...
agpl-3.0
pgr-me/metis_projects
05-lights/library/_02_clean.py
1
1176
import geopandas as gpd import pandas as pd import pickle # load, clean, and normalize country-level lights data with open('data/geo/pickles/zonal_stats_c.pickle') as f: gdf = pickle.load(f) gdf = pd.DataFrame(gdf) gdf = gdf.drop_duplicates(subset='WB_A3') gdf = gdf.set_index('WB_A3') gdf.drop(['ADMIN', 'CONTINEN...
gpl-3.0
Edu-Glez/Bank_sentiment_analysis
env/lib/python3.6/site-packages/pandas/tests/test_panelnd.py
7
3952
# -*- coding: utf-8 -*- import nose from pandas.core import panelnd from pandas.core.panel import Panel from pandas.util.testing import assert_panel_equal import pandas.util.testing as tm class TestPanelnd(tm.TestCase): def setUp(self): pass def test_4d_construction(self): with tm.assert_...
apache-2.0
VirusTotal/msticpy
msticpy/sectools/tiproviders/azure_sent_byoti.py
1
4854
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """ Azure ...
mit
alexlib/image_registration
examples/benchmarks_shift.py
4
6045
""" imsize map_coordinates fourier_shift 50 0.016211 0.00944495 84 0.0397182 0.0161059 118 0.077543 0.0443089 153 0.132948 0.058187 187 0.191808 0.0953341 221 0.276543 0....
mit
zfrenchee/pandas
pandas/tests/scalar/test_nat.py
1
9659
import pytest from datetime import datetime, timedelta import pytz import numpy as np from pandas import (NaT, Index, Timestamp, Timedelta, Period, DatetimeIndex, PeriodIndex, TimedeltaIndex, Series, isna) from pandas.util import testing as tm from pandas._libs.tslib import iNa...
bsd-3-clause
hotpxl/nebuchadnezzar
slides_plots.py
1
9381
#!/usr/bin/env python3.4 import datetime import math import matplotlib.pyplot as plt import matplotlib.dates import numpy as np import pandas import statsmodels.tsa.api import statsmodels.tsa.stattools import stats.data all_plots = [] def register_plot(func): def ret(*args, **kwargs): kwargs['func_name'] ...
mit
1kastner/analyse_weather_data
interpolation/visualise_semivariogram.py
1
4838
""" """ import logging import datetime import numpy import pandas from matplotlib import pyplot import dateutil.parser from pykrige.ok import OrdinaryKriging import geopy import geopy.distance from filter_weather_data import RepositoryParameter, get_repository_parameters from filter_weather_data.filters import Stat...
agpl-3.0
ilyes14/scikit-learn
sklearn/linear_model/bayes.py
220
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
danieldmm/minerva
models/models_util.py
1
1139
import matplotlib.pyplot as plt def plot_model_performance(train_loss, train_acc, train_val_loss, train_val_acc): """ Plot model loss and accuracy through epochs. """ green = '#72C29B' orange = '#FFA577' with plt.xkcd(): # plot model loss fig, ax1 = plt.subplots() ax1.plot(ra...
gpl-3.0
jjaner/essentia-musicbricks
src/examples/python/experimental/beatogram.py
10
26647
#!/usr/bin/env python # Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), e...
agpl-3.0
benoitsteiner/tensorflow
tensorflow/examples/learn/boston.py
33
1981
# 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
peterk87/sistr_cmd
sistr/misc/add_ref_genomes.py
1
20097
#!/usr/bin/env python import argparse from collections import defaultdict import logging, shutil import os from subprocess import Popen import re from datetime import datetime import sys import pandas as pd import numpy as np from sistr.misc.reduce_to_centroid_alleles import run_allele_reduction from sistr.sistr_cmd ...
apache-2.0
bendemott/Python-Shapely-Examples
shapelyAreaSearch.py
2
2419
''' @author Ben DeMott @file shapely_radius_plot.py In this example we will perform an area/radius search. We will create a bunch of points in a 2d coordinate system and then we will create a circle or a perimeter. The we will do a search for any points that are within the circles perimeter! :) :) :) ''' import r...
mit
jungla/ICOM-fluidity-toolbox
functions.py/detect_peaks.py
2
6546
from __future__ import division, print_function import numpy as np __author__ = "Marcos Duarte, https://github.com/demotu/BMC" __version__ = "1.0.4" __license__ = "MIT" def detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising', kpsh=False, valley=False, show=False, ax=None): """Detect pea...
gpl-2.0
NunoEdgarGub1/scikit-learn
sklearn/cluster/spectral.py
233
18153
# -*- coding: utf-8 -*- """Algorithms for spectral clustering""" # Author: Gael Varoquaux gael.varoquaux@normalesup.org # Brian Cheung # Wei LI <kuantkid@gmail.com> # License: BSD 3 clause import warnings import numpy as np from ..base import BaseEstimator, ClusterMixin from ..utils import check_rand...
bsd-3-clause
rohanp/scikit-learn
sklearn/gaussian_process/tests/test_gpr.py
28
11870
"""Testing for Gaussian process regression """ # Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Licence: BSD 3 clause import numpy as np from scipy.optimize import approx_fprime from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels \ import RBF, Constan...
bsd-3-clause
zingale/pyro2
analysis/sedov_compare.py
2
4306
#!/usr/bin/env python3 from __future__ import print_function import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from util import io import argparse mpl.rcParams["text.usetex"] = True mpl.rcParams['mathtext.fontset'] = 'cm' mpl.rcParams['mathtext.rm'] = 'serif' # font sizes mpl.rcParams['fon...
bsd-3-clause
talbarda/kaggle_predict_house_prices
Build Model.py
1
2629
import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import pandas as pd import sklearn.linear_model as lm from sklearn.model_selection import learning_curve from sklearn.metrics import accuracy_score from sklearn.metrics import make_scorer from sklearn.model_selection import Grid...
mit
466152112/scikit-learn
sklearn/mixture/tests/test_gmm.py
200
17427
import unittest import copy import sys from nose.tools import assert_true import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_raises) from scipy import stats from sklearn import mixture from sklearn.datasets.samples_generator import make_spd_ma...
bsd-3-clause
Obus/scikit-learn
examples/linear_model/plot_ols.py
220
1940
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Linear Regression Example ========================================================= This example uses the only the first feature of the `diabetes` dataset, in order to illustrate a two-dimensional plot of this regre...
bsd-3-clause
hitszxp/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
43
1791
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
dsullivan7/scikit-learn
examples/applications/svm_gui.py
287
11161
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
rahuldhote/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
saiwing-yeung/scikit-learn
examples/linear_model/plot_theilsen.py
100
3846
""" ==================== 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
sgoodm/python-distance-rasters
src/distancerasters/main.py
1
4523
from __future__ import absolute_import import time import numpy as np from affine import Affine from scipy.spatial import cKDTree from .utils import export_raster, convert_index_to_coords, calc_haversine_distance def build_distance_array(raster_array, affine=None, output=None, conditional=None): """build distanc...
bsd-3-clause
google-research/google-research
using_dl_to_annotate_protein_universe/hmm_baseline/hmmer_utils_test.py
1
16884
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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
yask123/scikit-learn
sklearn/utils/testing.py
71
26178
"""Testing utilities.""" # Copyright (c) 2011, 2012 # Authors: Pietro Berkes, # Andreas Muller # Mathieu Blondel # Olivier Grisel # Arnaud Joly # Denis Engemann # License: BSD 3 clause import os import inspect import pkgutil import warnings import sys import re import platf...
bsd-3-clause
lukauskas/scipy
scipy/stats/_binned_statistic.py
26
17723
from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy._lib.six import callable from collections import namedtuple __all__ = ['binned_statistic', 'binned_statistic_2d', 'binned_statistic_dd'] def binned_statistic(x, values, statistic='me...
bsd-3-clause
wdurhamh/statsmodels
statsmodels/datasets/tests/test_utils.py
26
1697
import os import sys from statsmodels.datasets import get_rdataset, webuse, check_internet from numpy.testing import assert_, assert_array_equal, dec cur_dir = os.path.dirname(os.path.abspath(__file__)) def test_get_rdataset(): # smoke test if sys.version_info[0] >= 3: #NOTE: there's no way to test bo...
bsd-3-clause
kagayakidan/scikit-learn
examples/model_selection/plot_validation_curve.py
229
1823
""" ========================== Plotting Validation Curves ========================== In this plot you can see the training scores and validation scores of an SVM for different values of the kernel parameter gamma. For very low values of gamma, you can see that both the training score and the validation score are low. ...
bsd-3-clause
Dannnno/odo
odo/backends/tests/test_csv.py
1
12718
from __future__ import absolute_import, division, print_function import pytest import sys import os import pandas as pd import pandas.util.testing as tm import gzip import datashape from datashape import Option, string from collections import Iterator from odo.backends.csv import (CSV, append, convert, resource, ...
bsd-3-clause
bfelbo/deepmoji
deepmoji/finetuning.py
2
23552
""" Finetuning functions for doing transfer learning to new datasets. """ from __future__ import print_function import sys import uuid from time import sleep import h5py import math import pickle import numpy as np from keras.layers.wrappers import Bidirectional, TimeDistributed from sklearn.metrics import f1_score ...
mit
johndpope/tensorflow
tensorflow/python/estimator/inputs/pandas_io_test.py
89
8340
# 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
aaichsmn/tacc_stats
setup.py
1
18706
#!/usr/bin/env python """ Parts of this file were taken from the pyzmq project (https://github.com/zeromq/pyzmq) which have been permitted for use under the BSD license. Parts are from lxml (https://github.com/lxml/lxml) """ import os import sys import shutil import warnings import re import ConfigParser import multi...
lgpl-2.1
jcmgray/xarray
xarray/core/computation.py
1
42875
""" Functions for applying functions that act on arrays to xarray's labeled data. """ from __future__ import absolute_import, division, print_function from distutils.version import LooseVersion import functools import itertools import operator from collections import Counter import numpy as np from . import duck_arra...
apache-2.0
gietal/Stocker
sandbox/udacity/1.py
1
1188
import pandas as pd import matplotlib.pyplot as plt def testRun(): df = pd.read_csv("data/MSFT.csv") print df.head() def getMaxClose(symbol): df = pd.read_csv("data/{}.csv".format(symbol)) # read data return df['Close'].max() def getMeanVolume(symbol): df = pd.read_csv("data/{}.csv".f...
mit
gheshu/synth
src/plot.py
1
1372
import math import matplotlib.pyplot as plt tau = 6.2831853 pi = 3.141592 samples = 10 dphase = tau / samples def lerp(a, b, alpha): return (1.0 - alpha) * a + alpha * b def saw_wave(phase): return lerp(-1.0, 1.0, phase / tau) def sine_wave(phase): return math.sin(phase) def square_wave(phase): if phase...
apache-2.0
samuel1208/scikit-learn
examples/exercises/plot_cv_diabetes.py
231
2527
""" =============================================== Cross-validation on diabetes Dataset Exercise =============================================== A tutorial exercise which uses cross-validation with linear models. This exercise is used in the :ref:`cv_estimators_tut` part of the :ref:`model_selection_tut` section of ...
bsd-3-clause
YuanGunGun/zeppelin
python/src/main/resources/python/bootstrap_sql.py
60
1189
# 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 use ...
apache-2.0
CERNDocumentServer/invenio
modules/bibauthorid/lib/bibauthorid_tortoise.py
3
16189
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2011, 2012 CERN. # # Invenio 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 option) any...
gpl-2.0
rsignell-usgs/notebook
People/csherwood/read_garmin_gpx_calc_effort.py
1
5449
# coding: utf-8 # # Read Garmin GPX with heartrate # # In[1]: import numpy as np import matplotlib.pyplot as plt from datetime import datetime import pandas as pd from lxml import etree get_ipython().magic(u'matplotlib inline') # In[2]: fn = "activity_721671330.gpx" tree = etree.parse(fn) # In[3]: namespace...
mit
amitjamadagni/sympy
sympy/plotting/plot.py
1
58450
"""Plotting module for Sympy. A plot is represented by the ``Plot`` class that contains a reference to the backend and a list of the data series to be plotted. The data series are instances of classes meant to simplify getting points and meshes from sympy expressions. ``plot_backends`` is a dictionary with all the bac...
bsd-3-clause
h2educ/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
MartinIsoz/MuPhFInCE
00_utilities/procLogOnlineSS.py
2
12534
#!/usr/bin/python #FILE DESCRIPTION======================================================= # # Simple python script to see the residuals evolution and other # simulation characteristics of the steady state OpenFOAM runs # # Required: # - file log.*Foam # - file log.blockMesh or log.snappyHexMesh or direct specific...
gpl-2.0
henridwyer/scikit-learn
examples/manifold/plot_compare_methods.py
259
4031
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
bsd-3-clause
eclee25/flu-SDI-exploratory-age
scripts/create_fluseverity_figs_v5/ILINet_incid_time_v5.py
1
4261
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 11/4/14 ###Function: Incidence per 100,000 vs. week number for flu weeks (wks 40-20). Incidence is per 100,000 for the US population in the second calendar year of the flu season. ILINet data ## 11/4/1...
mit
zehpunktbarron/iOSMAnalyzer
scripts/c3_highway_actuality.py
1
6584
# -*- coding: utf-8 -*- #!/usr/bin/python2.7 #description :This file creates a plot: Calculates the actuality of the total OSM highway. Additionally plots the first version for comparison purposes #author :Christopher Barron @ http://giscience.uni-hd.de/ #date :19.01.2013 #version :0.1 ...
gpl-3.0
oztalha/News-Commentary-Tweets-of-Elites
scrapers/scrape-theplazz.py
2
1332
# -*- coding: utf-8 -*- """ Created on Thu Jan 08 15:41:01 2015 @author: Talha """ from selenium import webdriver from selenium.webdriver.common.keys import Keys import pandas as pd import time #initialize variables df = pd.DataFrame(columns=('title', 'twcount', 'href')) driver = webdriver.Chrome() # thePlazz.com H...
mit
ngoix/OCRF
sklearn/gaussian_process/gaussian_process.py
16
34896
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
jpautom/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
linwoodc3/gdeltPyR
tests/test_info.py
1
3552
# #!/usr/bin/python # # -*- coding: utf-8 -*- # # # Author: # # Linwood Creekmore # # Email: valinvescap@gmail.com # # ############################## # # Standard Library Import # ############################## # # import os # from unittest import TestCase # # ############################## # # Third Party Libraries # ...
gpl-3.0
quasars100/Resonance_testing_scripts
alice/plotdata.py
1
2845
import matplotlib.pyplot as plt import pylab import numpy import rebound import reboundxf from pylab import * data = numpy.loadtxt('data.txt', unpack = True) time = data[0] e1 = data[1] e2 = data[2] pratio = data[3] l1 = data[4] l2 = data[5] varpi1 = data[6] varpi2 = data[7] a1 = data[8] a2 = data[9] sumpr = 0 for i...
gpl-3.0
vinodkc/spark
python/pyspark/sql/session.py
8
31156
# # 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
Eric89GXL/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
8
2692
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises) # Make an X tha...
bsd-3-clause
pwcazenave/PySeidon
pyseidon/adcpClass/plotsAdcp.py
2
3698
#!/usr/bin/python2.7 # encoding: utf-8 from __future__ import division import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as Tri import matplotlib.ticker as ticker import seaborn from windrose import WindroseAxes from interpolation_utils import * class PlotsAdcp: """'Plots' subset of FVCOM c...
agpl-3.0
hbp-unibi/SNABSuite
source/SNABs/mnist/python/mnist_view.py
1
1496
from __future__ import print_function from keras.datasets import mnist import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt # the data, split between train and test sets (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.reshape(60000, 784) x_test = x_test.reshape(10000, 7...
gpl-3.0
tomkooij/sapphire
scripts/kascade/reconstruction_efficiency.py
1
14972
from __future__ import division import tables import numpy as np import pylab as plt from scipy import optimize, stats from sapphire.analysis import landau import utils from artist import GraphArtist import artist.utils RANGE_MAX = 40000 N_BINS = 400 LOW, HIGH = 500, 5500 VNS = .57e-3 * 2.5 USE_TEX = True # F...
gpl-3.0