repo_name
stringlengths
9
55
path
stringlengths
7
120
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
169k
license
stringclasses
12 values
joshbohde/scikit-learn
examples/plot_permutation_test_for_classification.py
2
2049
""" ================================================================= Test with permutations the significance of a classification score ================================================================= In order to test if a classification score is significative a technique in repeating the classification procedure aft...
bsd-3-clause
CG-F16-24-Rutgers/steersuite-rutgers
steerstats/tools/plotting/plotMultiObjectiveData.py
8
1340
import csv import matplotlib.pyplot as plt import sys import numpy as np # filename = '../../data/optimization/sf/multiObjective/SteerStatsOpt2.csv' filename = sys.argv[1] xs = [] ys = [] if len(sys.argv) == 2: csvfile = open(filename, 'r') spamreader = csv.reader(csvfile, delimiter=',') xs = [] ys =...
gpl-3.0
maxlikely/scikit-learn
sklearn/pipeline.py
1
13051
""" The :mod:`sklearn.pipeline` module implements utilites to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Licence: BSD import numpy as np from scipy import sparse from .base impo...
bsd-3-clause
martinggww/lucasenlights
MachineLearning/python_tutorial/KNearestNeighborhood.py
1
1274
''' Classification algorithm Create a model that seperate a dataset proximity probability nearest neighbors What the hack is K? if K=2, find the closet 2 points We want K = odd numbers, K=3, 5, 7... ''' ''' - - +, 66.7% confidence, confidence, accuracy Euclid distance, euclid distance middle point Dataset and the rela...
cc0-1.0
treycausey/scikit-learn
sklearn/feature_selection/__init__.py
244
1088
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
bsd-3-clause
chenyyx/scikit-learn-doc-zh
examples/zh/cluster/plot_dict_face_patches.py
9
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
gpl-3.0
jrcapriles/gameSimulator
gameSimulator.py
1
6837
# -*- coding: utf-8 -*- """ Created on Thu Sep 18 19:27:57 2014 @author: joser """ import pygame, ode, random, Buttons from math import atan2, acos, asin, sin, cos import matplotlib.pyplot as plt from pygame.locals import * from numpy import * from Point import * from Buttons import * class gameSimulator( object ...
mit
stevenzhang18/Indeed-Flask
lib/pandas/tests/test_expressions.py
9
16557
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable-msg=W0612,E1101 import nose import re from numpy.random import randn import operator import numpy as np from pandas.core.api import DataFrame, Panel from pandas.computation import expressions as expr from pandas import compat from pand...
apache-2.0
drusk/pml
pml/unsupervised/clustering.py
1
11112
# Copyright (C) 2012 David Rusk # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distr...
mit
r39132/airflow
tests/contrib/operators/test_hive_to_dynamodb_operator.py
7
5053
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
jiangzhonglian/MachineLearning
src/py2.x/ml/6.SVM/svm-complete_Non-Kernel.py
1
13440
#!/usr/bin/python # coding:utf8 """ Created on Nov 4, 2010 Update on 2017-05-18 Chapter 5 source file for Machine Learing in Action Author: Peter/geekidentity/片刻 GitHub: https://github.com/apachecn/AiLearning """ from __future__ import print_function from numpy import * import matplotlib.pyplot as plt class optStruc...
gpl-3.0
Titan-C/sympy
sympy/physics/quantum/circuitplot.py
6
12937
"""Matplotlib based plotting of quantum circuits. Todo: * Optimize printing of large circuits. * Get this to work with single gates. * Do a better job checking the form of circuits to make sure it is a Mul of Gates. * Get multi-target gates plotting. * Get initial and final states to plot. * Get measurements to plo...
bsd-3-clause
LiaoPan/scikit-learn
examples/svm/plot_iris.py
225
3252
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
joernhees/scikit-learn
sklearn/ensemble/weight_boosting.py
29
41090
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
NolanBecker/aima-python
grading/neuralNet-submissions.py
4
2217
import importlib import traceback from grading.util import roster, print_table # from logic import FolKB # from utils import expr import os from sklearn.neural_network import MLPClassifier mlpc = MLPClassifier() def indent(howMuch = 1): space = ' ' for i in range(1, howMuch): space += ' ' return s...
mit
guillemborrell/gtable
tests/test_table_creation.py
1
4044
from gtable import Table import numpy as np import pandas as pd def test_empty_table(): t = Table() assert t.data == [] def test_simple_table(): t = Table({'a': [1, 2, 3], 'b': np.array([4, 5, 6])}) assert t.to_dict()['a'][2] == 3 assert np.all(t.index == np.ones((2, 3), dtype=np.uint8)) ...
bsd-3-clause
sysid/nbs
ml_old/Prognose/Evaluator.py
1
3134
from twBase import * # NOQA from pandas import DataFrame from pandas import read_csv from pandas import datetime from sklearn.preprocessing import MinMaxScaler # date-time parsing function for loading the dataset def parser(x): return datetime.strptime('190'+x, '%Y-%m') def get_time(): return time.strftime(...
mit
jjo31/ATHAM-Fluidity
tests/gls-Kato_Phillips-mixed_layer_depth/mixed_layer_depth_all.py
4
4600
#!/usr/bin/env python from numpy import arange,concatenate,array,argsort import os import sys import vtktools import math from pylab import * from matplotlib.ticker import MaxNLocator import re from scipy.interpolate import UnivariateSpline import glob #### taken from http://www.codinghorror.com/blog/archives/001018...
lgpl-2.1
OpenSourcePolicyCenter/multi-country
Python/Archive/Stage4/AuxiliaryClass.py
2
116307
from __future__ import division import csv import time import numpy as np import scipy as sp import scipy.optimize as opt from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D import AuxiliaryDemographics as demog #from pure_cython import cy_fillca class OLG(object): """ This object...
mit
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/tests/indexes/datetimes/test_tools.py
6
62998
""" test to_datetime """ import sys import pytest import locale import calendar import numpy as np from datetime import datetime, date, time from distutils.version import LooseVersion import pandas as pd from pandas._libs import tslib, lib from pandas.core.tools import datetimes as tools from pandas.core.tools.dateti...
mit
deepesch/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
297
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
lucidjuvenal/quis-custodiet
twitter_feed/twittest.py
1
1922
import twitter # python-twitter package from matplotlib.pyplot import pause import re ############################################ # secret data kept in separate file with open('twitdat.txt') as f: fromFile = {} for line in f: line = line.split() # to skip blank lines if len(line)==3 : # ...
gpl-3.0
rustychris/stompy
stompy/plot/plot_utils.py
1
45515
from __future__ import division from __future__ import print_function from builtins import str from builtins import zip from builtins import range from builtins import object import time from matplotlib.collections import LineCollection from matplotlib.transforms import Transform,Affine2D import matplotlib.transforms ...
mit
davidsoncasey/quiver-server
plot_equation.py
1
3888
from __future__ import division import re from math import sqrt import multiprocessing import Queue import sympy import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas class DiffEquation(object): ''' Class that contains equation informa...
mit
shernshiou/CarND
Term1/05-CarND-Vehicle-Detection/vehicle_detection.py
1
3518
import glob import cv2 import numpy as np import os from util.draw import generate_sliding_windows from util.draw import extract_heatmap from util.classifier import svm_classifier from util.classifier import transform_features from sklearn.preprocessing import StandardScaler from moviepy.editor import VideoFileClip he...
mit
vibhorag/scikit-learn
sklearn/metrics/setup.py
299
1024
import os import os.path import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("metrics", parent_package, top_path) cblas_libs, blas_info = get_blas_info() if os.name ==...
bsd-3-clause
BhallaLab/moose-full
moose-examples/snippets/MULTI/minchan.py
3
12176
# minimal.py --- # Upi Bhalla, NCBS Bangalore 2014. # # Commentary: # # Minimal model for loading rdesigneur: reac-diff elec signaling in neurons # # 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 Founda...
gpl-2.0
pavelchristof/gomoku-ai
tensorflow/contrib/labeled_tensor/python/ops/ops.py
77
46403
# 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
StongeEtienne/dipy
dipy/data/__init__.py
1
12766
""" Read test or example data """ from __future__ import division, print_function, absolute_import import sys import json from nibabel import load from os.path import join as pjoin, dirname import gzip import numpy as np from dipy.core.gradients import GradientTable, gradient_table from dipy.core.sphere import Sphe...
bsd-3-clause
McIntyre-Lab/papers
fear_sem_sd_2015/scripts/dspr_gene_ggm_neighborhood_analysis.py
1
4687
#!/usr/bin/env python import os import logging import numpy as np import networkx as nx import matplotlib.pyplot as plt import pickle def setLogger(fname,loglevel): """ Function to handle error logging """ logging.basicConfig(filename=fname, filemode='w', level=loglevel, format='%(asctime)s - %(levelname)s - ...
lgpl-3.0
jlegendary/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
liangz0707/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
bmazin/SDR
Projects/NewDataPacket/test_packet.py
1
2865
#!/bin/usr/python import numpy as np import matplotlib.pyplot as plt import struct import sys from bin import * bin_data_0=str(np.load('bin_data_0.npy')) bin_data_1=str(np.load('bin_data_1.npy')) phase_timestream=np.loadtxt('phase_timestream.txt') bin_max=len(bin_data_1)/4 addr0=969 addr1=3132 median = -0.04140515...
gpl-2.0
ychfan/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_input_test.py
72
12865
# 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
giorgiop/scikit-learn
examples/semi_supervised/plot_label_propagation_structure.py
55
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
muthujothi/CrowdAnalytix-CrimeRates-PredictiveModelling
selectFeatures.py
1
1038
import pandas as pd import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt import csv from scipy.stats.stats import pearsonr from collections import OrderedDict from collections import defaultdict #Load the train data df_1 = pd.read_csv('C:/Pst Files/CrowdAnalytix/CrimeRates/CA_Crime_Rate_...
mit
schae234/gingivere
tests/lr.py
2
1543
import pandas as pd import numpy as np from sklearn import preprocessing from sklearn.linear_model import LinearRegression from sklearn.cross_validation import StratifiedKFold import numpy as np from sklearn.metrics import classification_report from sklearn.metrics import roc_auc_score store = pd.HDFStore("D:/gingive...
mit
huazhisong/graduate_text
src/contrib_cnn/cnn_shallow.py
1
10681
# 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...
agpl-3.0
ruchee/vimrc
vimfiles/bundle/vim-python/submodules/pydocstyle/src/tests/test_cases/canonical_numpy_examples.py
3
5315
"""This is the docstring for the example.py module. Modules names should have short, all-lowercase names. The module name may have underscores if this improves readability. Every module should have a docstring at the very top of the file. The module's docstring may extend over multiple lines. If your docstring doe...
mit
magicrub/MissionPlanner
Lib/site-packages/numpy/fft/fftpack.py
59
39653
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
gpl-3.0
ketjow4/NOV
Lib/site-packages/numpy/fft/fftpack.py
59
39653
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
gpl-3.0
Adai0808/scikit-learn
sklearn/neighbors/nearest_centroid.py
199
7249
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Author: Robert Layton <robertlayton@gmail.com> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..met...
bsd-3-clause
adamhaney/airflow
setup.py
1
12977
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
pushpajnc/models
creating_customer_segments/renders.py
1
4134
import matplotlib.pyplot as plt import matplotlib.cm as cm import pandas as pd import numpy as np from sklearn.decomposition import pca def pca_results(good_data, pca): ''' Create a DataFrame of the PCA results Includes dimension feature weights and explained variance Visualizes the PCA results ''' # Dimension ...
mit
vsoch/nidmviewer
nidmviewer/sparql.py
1
4830
''' sparql.py: part of the nidmviewer package Sparql queries Copyright (c) 2014-2018, Vanessa Sochat 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 abo...
bsd-3-clause
YinongLong/scikit-learn
sklearn/linear_model/tests/test_perceptron.py
378
1815
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_raises from sklearn.utils import check_random_state from sklearn.datasets import load_iris from sklearn.linear_model import Pe...
bsd-3-clause
ZenDevelopmentSystems/scikit-learn
sklearn/tree/tests/test_export.py
130
9950
""" Testing for export functions of decision trees (sklearn.tree.export). """ from re import finditer from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.ensemble import GradientBoostingClassifier from sklearn...
bsd-3-clause
wmunters/py4sp
plotting/plot_sp.py
1
4504
import numpy as np import load_sp as lsp import matplotlib.pyplot as plt import os import windfarm as wf def set_equal_tight(ax=plt.gca()): ax.set_aspect('equal') ax.autoscale(tight=True) def plot_field_turbines(fieldfile='BL_field.dat', key='u', k=16): bl = lsp.load_BLfield_real(fieldfile) field = bl...
gpl-2.0
ishanic/scikit-learn
examples/ensemble/plot_adaboost_multiclass.py
354
4124
""" ===================================== Multi-class AdaBoosted Decision Trees ===================================== This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can improve prediction accuracy on a multi-class problem. The classification dataset is constructed by taking a ten-dimensional ...
bsd-3-clause
z/xonotic-map-repository
bin/entities_map.py
1
2980
#!/usr/bin/env python3 # Description: Plots entities on radars # Author: Tyler "-z-" Mulligan from matplotlib import pyplot as plt import numpy as np import matplotlib as mpl import matplotlib.font_manager as font_manager import struct import sys import os from xmr.entities import * path_entities = 'resources/entiti...
mit
shivaenigma/electrum
plugins/plot.py
5
3566
from PyQt4.QtGui import * from electrum.plugins import BasePlugin, hook from electrum.i18n import _ import datetime from electrum.util import format_satoshis from electrum.bitcoin import COIN try: import matplotlib.pyplot as plt import matplotlib.dates as md from matplotlib.patches import Ellipse fro...
gpl-3.0
jreback/pandas
pandas/tests/series/test_unary.py
3
1755
import pytest from pandas import Series import pandas._testing as tm class TestSeriesUnaryOps: # __neg__, __pos__, __inv__ def test_neg(self): ser = tm.makeStringSeries() ser.name = "series" tm.assert_series_equal(-ser, -1 * ser) def test_invert(self): ser = tm.makeStrin...
bsd-3-clause
ajylee/gpaw-rtxs
gpaw/testing/old_molecule_test.py
1
6841
# -*- coding: utf-8 -*- import sys import pickle import traceback import os.path as path from ase.data.g2_1 import data from ase.structure import molecule from ase.data.molecules import latex from ase.atoms import string2symbols from ase.parallel import paropen from ase.parallel import rank, barrier from ase.io.trajec...
gpl-3.0
jls713/jfactors
flattened/sampler.py
1
9246
## Generate samples from triaxiality distributions for Figures 9 & 10 and Table 5 of Sanders, Evans & Geringer-Sameth ## ============================================================================ import numpy as np from numpy import sqrt,cos,sin import emcee # import corner import sys sys.path.append('/home/jls/work...
mit
cerrno/neurokernel
examples/testLPU/visualize_testLPU.py
1
1818
#@author: Amol Kapoor #date: 3-13-15 #Visualizer for simpleLPU stuff import matplotlib as mpl mpl.use('agg') import neurokernel.LPU.utils.visualizer as vis import networkx as nx # Temporary fix for bug in networkx 1.8: nx.readwrite.gexf.GEXF.convert_bool = {'false':False, 'False':False, ...
bsd-3-clause
datapythonista/pandas
pandas/core/arrays/floating.py
3
13304
from __future__ import annotations import warnings import numpy as np from pandas._libs import ( lib, missing as libmissing, ) from pandas._typing import ( ArrayLike, DtypeObj, ) from pandas.compat.numpy import function as nv from pandas.util._decorators import cache_readonly from pandas.core.dtypes...
bsd-3-clause
tylerjereddy/scipy
scipy/cluster/tests/test_hierarchy.py
12
42543
# # Author: Damian Eads # Date: April 17, 2008 # # Copyright (C) 2008 Damian Eads # # 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...
bsd-3-clause
jlegendary/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
rohanp/scikit-learn
sklearn/cross_decomposition/cca_.py
151
3192
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
Atmosferica/Turbolenza
scripts/KDE/main.py
1
1050
#!/usr/bin/python #default module import numpy as np import matplotlib.pyplot as plt import scipy.fftpack as fftp import scipy.optimize as opt import sys import os import string from statsmodels.nonparametric.kernel_density import KDEMultivariate from bcolors import * from funct import * def kde_m(x, x_grid, bandw...
gpl-3.0
FYECorpusProject/thesaurus-and-citation
Histograms20150820/histoparagraphone.py
2
38019
#!/usr/bin/env python ## use python 2.7 import sys from collections import defaultdict from os import listdir from histogramcode import Histogram from histosentence import HistoSentence ## import numpy as np import matplotlib.pyplot as plt ALIGNMENTDUMMYPARA = -9 ALIGNMENTDUMMYSUB = -99 DISTANCEDUMMY = -999 ########...
gpl-2.0
BhallaLab/moose-full
moose-examples/tutorials/ChemicalBistables/propagationBis.py
2
6232
######################################################################### ## This program is part of 'MOOSE', the ## Messaging Object Oriented Simulation Environment. ## Copyright (C) 2014 Upinder S. Bhalla. and NCBS ## It is made available under the terms of the ## GNU Lesser General Public License version 2...
gpl-2.0
mne-tools/mne-tools.github.io
0.19/_downloads/f911a8ff6ce16e7e3e5057bbf8b5a690/plot_stats_cluster_time_frequency_repeated_measures_anova.py
2
10044
""" .. _tut-timefreq-twoway-anova: ==================================================================== Mass-univariate twoway repeated measures ANOVA on single trial power ==================================================================== This script shows how to conduct a mass-univariate repeated measures ANOVA. ...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/sklearn/feature_selection/tests/test_base.py
98
3681
import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from sklearn.base import BaseEstimator from sklearn.feature_selection.base import SelectorMixin from sklearn.utils import check_array from sklearn.utils.testing import assert_raises, assert_equal class StepSelector(Select...
mit
adelomana/schema
conditionedFitness/figureMutagenized/script.2.3.py
2
2965
import matplotlib,numpy,sys,scipy,pickle import matplotlib.pyplot sys.path.append('../lib') import calculateStatistics ### MAIN matplotlib.rcParams.update({'font.size':36,'font.family':'Times New Roman','xtick.labelsize':28,'ytick.labelsize':28}) thePointSize=12 jarDir='/Users/adriandelomana/scratch/' # mutagenized...
gpl-3.0
kerimlcr/ab2017-dpyo
ornek/osmnx/osmnx-0.3/osmnx/save_load.py
1
16292
################################################################################################### # Module: save_load.py # Description: Save and load networks to/from disk # License: MIT, see full license in LICENSE.txt # Web: https://github.com/gboeing/osmnx ##########################################################...
gpl-3.0
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/legend_handler.py
4
22859
""" This module defines default legend handlers. It is strongly encouraged to have read the :ref:`legend guide <plotting-guide-legend>` before this documentation. Legend handlers are expected to be a callable object with a following signature. :: legend_handler(legend, orig_handle, fontsize, handlebox) Where *l...
bsd-2-clause
samuel1208/scikit-learn
sklearn/semi_supervised/tests/test_label_propagation.py
307
1974
""" test the label propagation module """ import nose import numpy as np from sklearn.semi_supervised import label_propagation from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal ESTIMATORS = [ (label_propagation.LabelPropagation, {'kernel': 'rbf'}), (label_propa...
bsd-3-clause
zfrenchee/pandas
pandas/tests/reshape/merge/test_merge_ordered.py
2
2966
import pandas as pd from pandas import DataFrame, merge_ordered from pandas.util import testing as tm from pandas.util.testing import assert_frame_equal from numpy import nan class TestMergeOrdered(object): def setup_method(self, method): self.left = DataFrame({'key': ['a', 'c', 'e'], ...
bsd-3-clause
dsockwell/trading-with-python
lib/backtest.py
74
7381
#------------------------------------------------------------------------------- # Name: backtest # Purpose: perform routine backtesting tasks. # This module should be useable as a stand-alone library outide of the TWP package. # # Author: Jev Kuznetsov # # Created: 03/07/2014 ...
bsd-3-clause
fulmicoton/pylearn2
pylearn2/cross_validation/dataset_iterators.py
29
19389
""" Cross-validation dataset iterators. """ __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "3-clause BSD" import numpy as np import warnings try: from sklearn.cross_validation import (KFold, StratifiedKFold, ShuffleSplit, ...
bsd-3-clause
raghavrv/scikit-learn
sklearn/utils/tests/test_murmurhash.py
79
2849
# Author: Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import numpy as np from sklearn.externals.six import b, u from sklearn.utils.murmurhash import murmurhash3_32 from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from sklearn.utils.testing import ...
bsd-3-clause
B3AU/waveTree
sklearn/cluster/tests/test_spectral.py
5
9160
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle from sklearn.metrics.pairwise import kernel_metrics 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 ass...
bsd-3-clause
laurent-george/bokeh
examples/app/stock_applet/stock_app.py
42
7786
""" This file demonstrates a bokeh applet, which can either be viewed directly on a bokeh-server, or embedded into a flask application. See the README.md file in this directory for instructions on running. """ import logging logging.basicConfig(level=logging.DEBUG) from os import listdir from os.path import dirname,...
bsd-3-clause
logpai/logparser
benchmark/LKE_benchmark.py
1
5357
#!/usr/bin/env python import sys sys.path.append('../') from logparser import LKE, evaluator import os import pandas as pd input_dir = '../logs/' # The input directory of log file output_dir = 'LKE_result/' # The output directory of parsing results benchmark_settings = { 'HDFS': { 'log_file'...
mit
bsipocz/statsmodels
examples/python/kernel_density.py
33
1805
## Kernel Density Estimation import numpy as np from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.distributions.mixture_rvs import mixture_rvs ##### A univariate example. np.random.seed(12345) obs_dist1 = mixture_rvs([.25,.75], size=10000, dist=[stats.norm, sta...
bsd-3-clause
ypid/series60-remote
pc/widget/StatisticCanvas.py
1
2637
# -*- coding: utf-8 -*- # Copyright (c) 2008 - 2009 Lukas Hetzenecker <LuHe@gmx.at> from PyQt4.QtCore import * from PyQt4.QtGui import * # Matplotlib try: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as Navig...
gpl-2.0
kakaba2009/MachineLearning
python/src/mylib/mlstm.py
1
9814
import math import os.path import numpy as np import pandas as pd import matplotlib.pyplot as plt import src.mylib.mfile as mfile import src.mylib.mcalc as mcalc from matplotlib import style from keras.utils import np_utils from keras.optimizers import Adam, RMSprop from sklearn.preprocessing import MinMaxSca...
apache-2.0
tochikuji/chainer-libDNN
examples/mnist/AE.py
1
1210
# example of Convolutional Auto-encoder with layer visualization from libdnn import AutoEncoder import chainer import chainer.functions as F import chainer.optimizers as Opt import numpy from sklearn.datasets import fetch_mldata model = chainer.FunctionSet( fh1=F.Linear(28 ** 2, 100), fh3=F.Linear(100, 28 **...
mit
kdebrab/pandas
asv_bench/benchmarks/reshape.py
3
3829
from itertools import product import numpy as np from pandas import DataFrame, MultiIndex, date_range, melt, wide_to_long from .pandas_vb_common import setup # noqa class Melt(object): goal_time = 0.2 def setup(self): self.df = DataFrame(np.random.randn(10000, 3), columns=['A', 'B', 'C']) ...
bsd-3-clause
decvalts/cartopy
lib/cartopy/tests/mpl/test_images.py
1
6074
# (C) British Crown Copyright 2011 - 2018, 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)...
gpl-3.0
endolith/scipy
scipy/spatial/kdtree.py
11
33807
# Copyright Anne M. Archibald 2008 # Released under the scipy license import numpy as np import warnings from .ckdtree import cKDTree, cKDTreeNode __all__ = ['minkowski_distance_p', 'minkowski_distance', 'distance_matrix', 'Rectangle', 'KDTree'] def minkowski_distance_p(x, y, p=2): """Compu...
bsd-3-clause
mne-tools/mne-tools.github.io
0.22/_downloads/e8440d4a71ce3cd53b39ebc6f55d87ec/plot_linear_regression_raw.py
18
2385
""" ======================================== Regression on continuous data (rER[P/F]) ======================================== This demonstrates how rER[P/F]s - regressing the continuous data - is a generalisation of traditional averaging. If all preprocessing steps are the same, no overlap between epochs exists, and ...
bsd-3-clause
MikeDelaney/sentiment
skeleton.py
1
2705
import sys, os import numpy as np from operator import itemgetter as ig from sklearn.linear_model import LogisticRegression as LR from collections import Counter import string # vocab = [] # the features used in the classifier # build vocabulary def buildvocab(numwords): vocab = [] temp_words = [] base...
mit
BDannowitz/polymath-progression-blog
jlab-ml-lunch-2/src/jlab.py
1
8171
import re from io import StringIO import pandas as pd import numpy as np from math import floor import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from tensorflow.keras.preprocessing.sequence import pad_sequences COLS = ['x', 'y', 'z', 'px', 'py', 'pz', 'x1', 'y1', 'z1', 'px1', 'py1', 'pz...
gpl-2.0
meduz/scikit-learn
examples/preprocessing/plot_function_transformer.py
158
1993
""" ========================================================= 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
dsm054/pandas
asv_bench/benchmarks/panel_ctor.py
3
1731
import warnings from datetime import datetime, timedelta from pandas import DataFrame, Panel, DatetimeIndex, date_range class DifferentIndexes(object): def setup(self): self.data_frames = {} start = datetime(1990, 1, 1) end = datetime(2012, 1, 1) for x in range(100): e...
bsd-3-clause
aewhatley/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
213
3359
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
alpenwasser/laborjournal
versuche/skineffect/python/vollzylinder_highfreq_approx_low.py
1
8960
#!/usr/bin/env python3 from sympy import * from mpmath import * from matplotlib.pyplot import * import matplotlib.ticker as plticker #init_printing() # make things prettier when we print stuff for debugging. # ************************************************************************** # # B-Field, Cylinder Coi...
mit
XianliangJ/collections
RCP-NS2/scripts/plot.py
1
3051
import math import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import scipy import sys # Parse command-line arguments. RCP_DATA_FILE = sys.argv[1] TCP_DATA_FILE = sys.argv[2] PLOT_FILE = sys.argv[3] # Bottleneck link speed in b/s. C = float(sys.argv[4]) * 1000000000 # RTT in seconds. RTT = float...
gpl-3.0
Titan-C/scikit-learn
examples/linear_model/plot_iris_logistic.py
119
1679
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <https://en.wikipedia.org/wiki/Iris_...
bsd-3-clause
aarchiba/numpy
doc/example.py
81
3581
"""This is the docstring for the example.py module. Modules names should have short, all-lowercase names. The module name may have underscores if this improves readability. Every module should have a docstring at the very top of the file. The module's docstring may extend over multiple lines. If your docstring doe...
bsd-3-clause
chenyyx/scikit-learn-doc-zh
examples/en/cluster/plot_mini_batch_kmeans.py
53
4096
""" ==================================================================== Comparison of the K-Means and MiniBatchKMeans clustering algorithms ==================================================================== We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is faster, but give...
gpl-3.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/matplotlib/pylab.py
8
11110
""" This is a procedural interface to the matplotlib object-oriented plotting library. The following plotting commands are provided; the majority have MATLAB |reg| [*]_ analogs and similar arguments. .. |reg| unicode:: 0xAE _Plotting commands acorr - plot the autocorrelation function annotate - annotate som...
apache-2.0
Ryanglambert/pybrain
examples/rl/environments/linear_fa/bicycle.py
26
14462
from __future__ import print_function """An attempt to implement Randlov and Alstrom (1998). They successfully use reinforcement learning to balance a bicycle, and to control it to drive to a specified goal location. Their work has been used since then by a few researchers as a benchmark problem. We only implement th...
bsd-3-clause
Maplenormandy/list-62x
python/testAlgorithms.py
1
13897
import cv2 import math import pandas as pd import numpy as np import time, sys, os, shutil import yaml from multiprocessing import Process, Queue from Queue import Empty import random import imageFeatures as imf import pickle from sklearn import gaussian_process """ # This script collects data if len(sys.argv) < 2: ...
mit
LohithBlaze/scikit-learn
examples/ensemble/plot_bias_variance.py
357
7324
""" ============================================================ Single estimator versus bagging: bias-variance decomposition ============================================================ This example illustrates and compares the bias-variance decomposition of the expected mean squared error of a single estimator again...
bsd-3-clause
tudarmstadt-lt/sensegram
eval/significance.py
1
2090
from scipy.stats import binom from pandas import read_csv import numpy as np import argparse def mcnemar_midp(b, c): """Compute McNemar's test using the "mid-p" variant suggested by: M.W. Fagerland, S. Lydersen, P. Laake. 2013. The McNemar test for binary matched-pairs data: Mid-p and asymptotic are...
apache-2.0
hainm/scikit-learn
sklearn/neural_network/tests/test_rbm.py
142
6276
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
steelee/fishbowl-notebooks
ipython/profile_nbserver/ipython_config.py
2
20465
# Configuration file for ipython. c = get_config() #------------------------------------------------------------------------------ # InteractiveShellApp configuration #------------------------------------------------------------------------------ # A Mixin for applications that start InteractiveShell instances. # #...
mit