repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
plissonf/scikit-learn
sklearn/linear_model/coordinate_descent.py
59
76336
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
DonBeo/scikit-learn
sklearn/utils/tests/test_class_weight.py
14
6559
import numpy as np from sklearn.utils.class_weight import compute_class_weight from sklearn.utils.class_weight import compute_sample_weight from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.uti...
bsd-3-clause
Phil9l/cosmos
code/artificial_intelligence/src/naive_bayes/gaussian_naive_bayes.py
3
1370
# example using iris dataset # Part of Cosmos by OpenGenus import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB from sklearn.metrics import classification_report, confusion_matrix dataset = pd.read_csv("ir...
gpl-3.0
xyguo/scikit-learn
sklearn/decomposition/nmf.py
6
46993
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck # Mathieu Blondel <mathieu@mblondel.org> # Tom Dupre la Tour # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # NMF implementation) # ...
bsd-3-clause
embray/numpy
numpy/lib/npyio.py
1
66490
from __future__ import division, absolute_import, print_function import sys import os import re import itertools import warnings import weakref from operator import itemgetter import numpy as np from . import format from ._datasource import DataSource from ._compiled_base import packbits, unpackbits from ._iotools im...
bsd-3-clause
Healthcast/RSV
python/all_year_predict/methods.py
2
3879
#!/usr/bin/pyhton import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, neighbors, linear_model from sklearn import svm from sklearn import metrics from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier def apply_algorithm(paras, X, y): ...
gpl-2.0
nmayorov/scikit-learn
examples/plot_multilabel.py
236
4157
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
rs2/pandas
pandas/tests/io/parser/test_na_values.py
2
15082
""" Tests that NA values are properly handled during parsing for all of the parsers defined in parsers.py """ from io import StringIO import numpy as np import pytest from pandas._libs.parsers import STR_NA_VALUES from pandas import DataFrame, Index, MultiIndex import pandas._testing as tm def test_string_nas(all_...
bsd-3-clause
kazemakase/scikit-learn
sklearn/feature_extraction/text.py
24
50103
# -*- 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
rjenc29/numerical
course/matplotlib/examples/fill_example.py
1
2229
""" Illustrate different ways of using the various fill functions. """ import numpy as np import matplotlib.pyplot as plt import example_utils def main(): fig, axes = example_utils.setup_axes() fill_example(axes[0]) fill_between_example(axes[1]) stackplot_example(axes[2]) example_utils.title(fig...
mit
tjhunter/phd-thesis-tjhunter
python/kdd/plot_network.py
1
1065
__author__ = 'tjhunter' import build import json import pylab as pl from matplotlib.collections import LineCollection # Draws the network as a pdf and SVG file. def draw_network(ax, fd, link_style): def decode_line(l): #print l dct = json.loads(l) lats = dct['lats'] lons = dct['lons'] return zi...
apache-2.0
kcompher/thunder
thunder/extraction/source.py
6
31847
from numpy import asarray, mean, sqrt, ndarray, amin, amax, concatenate, sum, zeros, maximum, \ argmin, newaxis, ones, delete, NaN, inf, isnan, clip, logical_or, unique, where, all from thunder.utils.serializable import Serializable from thunder.utils.common import checkParams, aslist from thunder.rdds.images impo...
apache-2.0
amanzi/ats-dev
tools/utils/transect_data.py
2
7741
"""Loads and/or plots 2D, topologlically structured data on quadrilaterals using matplotlib. """ import sys,os import numpy as np import h5py import mesh import colors def fullname(varname): fullname = varname if not '.cell.' in fullname: fullname = fullname+'.cell.0' return fullname def transec...
bsd-3-clause
lbishal/scikit-learn
examples/gaussian_process/plot_gpc_isoprobability.py
45
3025
#!/usr/bin/python # -*- coding: utf-8 -*- """ ================================================================= Iso-probability lines for Gaussian Processes classification (GPC) ================================================================= A two-dimensional classification example showing iso-probability lines for...
bsd-3-clause
montagnero/political-affiliation-prediction
newsreader.py
2
11936
# -*- coding: utf-8 -*- from sklearn.decomposition import KernelPCA from sklearn.metrics.pairwise import pairwise_distances from scipy.stats.mstats import zscore import glob import json import re import datetime import os import cPickle import codecs import itertools from sklearn.feature_extraction.text import TfidfVec...
mit
bikong2/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
244
6011
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
hsuantien/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py
254
2253
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
MostafaGazar/tensorflow
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
mtconley/turntable
test/lib/python2.7/site-packages/scipy/stats/tests/test_morestats.py
7
38719
# Author: Travis Oliphant, 2002 # # Further enhancements and tests added by numerous SciPy developers. # from __future__ import division, print_function, absolute_import import warnings import numpy as np from numpy.random import RandomState from numpy.testing import (TestCase, run_module_suite, assert_array_equal, ...
mit
mjgrav2001/scikit-learn
sklearn/decomposition/base.py
313
5647
"""Principal Component Analysis Base Classes""" # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Kyle Kastner <kastnerkyle@gmail.com> # # Licen...
bsd-3-clause
markhamstra/spark
examples/src/main/python/sql/arrow.py
13
3997
# # 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
elkingtonmcb/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
Vimos/scikit-learn
sklearn/utils/testing.py
29
25405
"""Testing utilities.""" # Copyright (c) 2011, 2012 # Authors: Pietro Berkes, # Andreas Muller # Mathieu Blondel # Olivier Grisel # Arnaud Joly # Denis Engemann # Giorgio Patrini # Thierry Guillemot # License: BSD 3 clause import os import inspect import p...
bsd-3-clause
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/datasets/mlcomp.py
289
3855
# Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause """Glue code to load http://mlcomp.org data as a scikit.learn dataset""" import os import numbers from sklearn.datasets.base import load_files def _load_document_classification(dataset_path, metadata, set_=None, **kwargs): if ...
unlicense
antoinecarme/pyaf
tests/perf/test_ozone_debug_perf.py
1
1566
import pandas as pd import numpy as np # from memory_profiler import profile # from memprof import * import pyaf.ForecastEngine as autof import pyaf.Bench.TS_datasets as tsds #get_ipython().magic('matplotlib inline') # @memprof def test_ozone_debug_perf(): b1 = tsds.load_ozone() df = b1.mPastData # df...
bsd-3-clause
nkhuyu/seizure-prediction
ensemble.py
2
9703
#!/usr/bin/env python2.7 from multiprocessing import Pool import sys import numpy as np from sklearn.metrics import roc_auc_score from seizure_prediction.classifiers import make_svm, make_simple_lr, make_lr from seizure_prediction.feature_selection import generate_feature_masks from seizure_prediction.fft_bins impor...
mit
keir-rex/zipline
zipline/utils/tradingcalendar_tse.py
24
10413
# # Copyright 2014 Quantopian, Inc. # # 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 wr...
apache-2.0
Sentient07/scikit-learn
sklearn/tests/test_grid_search.py
27
29492
""" Testing for grid search module (sklearn.grid_search) """ from collections import Iterable, Sized from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.externals.six.moves import xrange from itertools import chain, product import pickle import warnings import sys import numpy as np import sci...
bsd-3-clause
fdudatamining/framework
tests/draw/test_simple.py
1
1233
import numpy as np import pandas as pd from unittest import TestCase from framework import draw X = np.array([1, 2, 3, 4, 5]) class TestSimplePlots(TestCase): def test_kinds(self): self.assertIsNotNone(draw.draw_kinds) def test_line(self): draw.draw(clear=True, kind='line', x=X, y=X) draw.draw(clear=...
gpl-2.0
stevertaylor/NX01
newcmaps.py
28
50518
# New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, # and (in the case of viridis) Eric Firing. # # This file and the colormaps in it are released under the CC0 license / # public domain dedication. We would appreciate credit if you use or # redistribute these colormaps, but do not impose any legal r...
mit
anntzer/scikit-learn
sklearn/ensemble/__init__.py
12
1655
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification, regression and anomaly detection. """ import typing from ._base import BaseEnsemble from ._forest import RandomForestClassifier from ._forest import RandomForestRegressor from ._forest import RandomTreesEmbedding from ._forest i...
bsd-3-clause
natj/bender
paper/figs/fig9.py
1
4141
import numpy as np import math from pylab import * from palettable.wesanderson import Zissou_5 as wsZ import matplotlib.ticker as mtick from scipy.interpolate import interp1d from scipy.interpolate import griddata from scipy.signal import savgol_filter def smooth(xx, yy): yy = savgol_filter(yy, 7, 2) np.cl...
mit
pianomania/scikit-learn
sklearn/linear_model/stochastic_gradient.py
16
50617
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np from abc import ABCMeta, abstractmethod from ..externals.joblib import ...
bsd-3-clause
mhue/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
vermouthmjl/scikit-learn
sklearn/gaussian_process/tests/test_gpr.py
23
11915
"""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
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/tseries/frequencies.py
2
15559
from datetime import timedelta import re from typing import Dict import numpy as np from pytz import AmbiguousTimeError from pandas._libs.algos import unique_deltas from pandas._libs.tslibs import Timedelta, Timestamp from pandas._libs.tslibs.ccalendar import MONTH_ALIASES, int_to_weekday from pandas._libs.tslibs.fie...
apache-2.0
jmargeta/scikit-learn
sklearn/tests/test_pls.py
6
9383
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.datasets import load_linnerud from sklearn import pls def test_pls(): d = load_linnerud() X = d.data Y = d.target # 1) Canonical (symetric) PLS (PLS 2 blocks canonical mode A) # ============================...
bsd-3-clause
Shatki/PyIMU
test/magnetosphere.py
1
1580
from mpl_toolkits.mplot3d import axes3d import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from socket import * import time # Объявляем все глобальные переменные HOST = '192.168.0.76' PORT = 21566 BUFSIZ = 512 ADDR = (HOST, PORT) bad_packet = 0 good_packet = 0 # fig, ax...
gpl-3.0
DamCB/tyssue
tyssue/draw/ipv_draw.py
2
8114
"""3D visualisation inside the notebook. """ import warnings import numpy as np import pandas as pd from matplotlib import cm from ipywidgets import interact from ..config.draw import sheet_spec from ..utils.utils import spec_updater, get_sub_eptm try: import ipyvolume as ipv except ImportError: print( ...
gpl-3.0
LiaoPan/scikit-learn
sklearn/cluster/tests/test_dbscan.py
114
11393
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
ephes/scikit-learn
examples/decomposition/plot_faces_decomposition.py
204
4452
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
bsd-3-clause
devanshdalal/scikit-learn
examples/ensemble/plot_isolation_forest.py
39
2361
""" ========================================== IsolationForest example ========================================== An example using IsolationForest for anomaly detection. The IsolationForest 'isolates' observations by randomly selecting a feature and then randomly selecting a split value between the maximum and minimu...
bsd-3-clause
thp44/delphin_6_automation
data_process/2d_1d/archieve/moisture_content_comparison.py
1
18274
__author__ = "Christian Kongsgaard" __license__ = 'MIT' # -------------------------------------------------------------------------------------------------------------------- # # IMPORTS # Modules import pandas as pd import matplotlib.pyplot as plt # RiBuild Modules # -----------------------------------------------...
mit
miaecle/deepchem
devtools/archive/jenkins/generate_graph.py
2
5220
import csv import os import numpy as np import matplotlib.pyplot as plt import time plt.switch_backend('agg') TODO = { ('tox21', 'random'): [ 'weave', 'graphconv', 'tf', 'tf_robust', 'irv', 'xgb', 'logreg', 'textcnn' ], ('clintox', 'random'): [ 'weave', 'graphconv', 'tf', 'tf_robust...
mit
xiongzhenggang/xiongzhenggang.github.io
AI/data/deeplearning24054/planar_utils.py
2
2271
import matplotlib.pyplot as plt import numpy as np import sklearn import sklearn.datasets import sklearn.linear_model def plot_decision_boundary(model, X, Y): # Set min and max values and give it some padding x_min, x_max = X[0, :].min() - 1, X[0, :].max() + 1 y_min, y_max = X[1, :].min() - 1, X[1, :].max(...
gpl-3.0
airanmehr/bio
Scripts/TimeSeriesPaper/Plot/topSNPs.py
1
1589
''' Copyleft Oct 14, 2016 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com ''' import numpy as np; np.set_printoptions(linewidth=200, precision=5, suppress=True) import pandas as pd; pd.options.display.max_rows = 20; pd.options.display.expand_frame_repr = False import seaborn as sns im...
mit
sighingnow/sighingnow.github.io
resource/k_nearest_neighbors/dating.py
1
3622
#! /usr/bin/env python # -*- coding: utf-8 ''' Name: dating.py(KNN algorithm) Training and test dataset: dating.txt Created on Feb 8, 2015 @author: Tao He ''' __author__ = 'Tao He' from numpy import array as nmarray from matplotlib import pyplot as plt LABEL_MAP = { 'didntLike': 1, 'sma...
mit
ZenDevelopmentSystems/scikit-learn
sklearn/cluster/mean_shift_.py
96
15434
"""Mean shift clustering algorithm. Mean shift clustering aims to discover *blobs* in a smooth density of samples. It is a centroid based algorithm, which works by updating candidates for centroids to be the mean of the points within a given region. These candidates are then filtered in a post-processing stage to elim...
bsd-3-clause
Obus/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
85
6377
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
nightjean/Deep-Learning
tensorflow/examples/learn/text_classification_character_rnn.py
61
3350
# 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
cswiercz/sympy
sympy/physics/quantum/state.py
58
29186
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import u, range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr ...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/doc/mpl_examples/pylab_examples/demo_bboximage.py
12
1805
import matplotlib.pyplot as plt import numpy as np from matplotlib.image import BboxImage from matplotlib.transforms import Bbox, TransformedBbox if __name__ == "__main__": fig = plt.figure(1) ax = plt.subplot(121) txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w") kwargs = dict() ...
gpl-2.0
bikong2/scikit-learn
sklearn/tests/test_discriminant_analysis.py
19
11711
try: # Python 2 compat reload except NameError: # Regular Python 3+ import from importlib import reload import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.t...
bsd-3-clause
kgullikson88/General
Analyze_CCF.py
1
9048
""" This is a module to read in an HDF5 file with CCFs. Use this to determine the best parameters, and plot the best CCF for each star/date """ from collections import defaultdict import logging import h5py import numpy as np import pandas as pd from scipy.interpolate import InterpolatedUnivariateSpline as spline cl...
gpl-3.0
Obus/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
cle1109/scot
doc/sphinxext/inheritance_diagram.py
4
13650
""" Defines a docutils directive for inserting inheritance diagrams. Provide the directive with one or more classes or modules (separated by whitespace). For modules, all of the classes in that module will be used. Example:: Given the following classes: class A: pass class B(A): pass class C(A): pass ...
mit
great-expectations/great_expectations
tests/dataset/test_sparkdfdataset.py
1
14191
import importlib.util import json from unittest import mock import pandas as pd import pytest from great_expectations.dataset.sparkdf_dataset import SparkDFDataset from great_expectations.util import is_library_loadable def test_sparkdfdataset_persist(spark_session): df = pd.DataFrame({"a": [1, 2, 3]}) sdf ...
apache-2.0
hdmetor/scikit-learn
examples/text/hashing_vs_dict_vectorizer.py
284
3265
""" =========================================== FeatureHasher and DictVectorizer Comparison =========================================== Compares FeatureHasher and DictVectorizer by using both to vectorize text documents. The example demonstrates syntax and speed only; it doesn't actually do anything useful with the e...
bsd-3-clause
davidtrem/ThunderStorm
thunderstorm/lightning/utils.py
1
5027
# -*- coding: utf-8 -*- # Copyright (C) 2010-2013 Trémouilles David #This file is part of Thunderstorm. # #ThunderStrom 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, o...
gpl-3.0
klahnakoski/ActiveData
vendor/mo_testing/fuzzytestcase.py
1
9712
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Contact: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import unicode_literals impor...
mpl-2.0
tbullmann/heuhaufen
publication/generators_and_depth/aggregate.py
1
5320
import os import pandas import numpy as np from bokeh.palettes import Viridis4 as palette from bokeh.layouts import layout, column, row from bokeh.plotting import figure, output_file, show, ColumnDataSource from bokeh.models import HoverTool, Div, DataTable, TableColumn, NumberFormatter, LinearAxis, Select, CustomJS, ...
mit
attia42/twitter_word2vec
kmeans/experimentm.py
1
3559
import csv import nltk from nltk.tokenize import word_tokenize import string from nltk import pos_tag from gensim.models.word2vec import Word2Vec from gensim import matutils from numpy import array, float32 as REAL from sklearn.cluster import MiniBatchKMeans, KMeans from multiprocessing import Pool from collections imp...
mit
mtconley/turntable
test/lib/python2.7/site-packages/scipy/interpolate/fitpack2.py
7
57978
""" fitpack --- curve and surface fitting with splines fitpack is based on a collection of Fortran routines DIERCKX by P. Dierckx (see http://www.netlib.org/dierckx/) transformed to double routines by Pearu Peterson. """ # Created by Pearu Peterson, June,August 2003 from __future__ import division, print_function, abs...
mit
nilbody/h2o-3
h2o-py/tests/testdir_golden/pyunit_svd_1_golden.py
1
2402
from __future__ import print_function from builtins import zip import sys sys.path.insert(1,"../../") import h2o from tests import pyunit_utils def svd_1_golden(): print("Importing USArrests.csv data...") arrestsH2O = h2o.upload_file(pyunit_utils.locate("smalldata/pca_test/USArrests.csv")) print("Co...
apache-2.0
UKPLab/emnlp2017-claim-identification
src/main/python/process_data_se_WithDevel.py
1
4976
import cPickle import numpy as np import pandas as pd import re import sys from collections import defaultdict def build_data_cv(data_folder, cv=10, clean_string=True): """ Loads data. """ revs = [] pos_file = data_folder[0] # train file neg_file = data_folder[1] # test file devel_file = d...
apache-2.0
imatge-upc/saliency
shallow/train.py
2
3064
# add to kfkd.py from lasagne import layers from lasagne.updates import nesterov_momentum from nolearn.lasagne import NeuralNet,BatchIterator import os import numpy as np from sklearn.utils import shuffle import cPickle as pickle import matplotlib.pyplot as plt import Image import ImageOps from scipy import misc import...
mit
bromjiri/Presto
predictor/predictor_new.py
1
8137
import settings import pandas as pd import numpy as np import os from datetime import datetime from datetime import timedelta import predictor.predictor_classifier as cls import predictor.predictor_statistic as stat import random import nltk class Stock: def __init__(self, subject): input_file = settings...
mit
dingmingliu/quanttrade
bt/core.py
1
37660
""" Contains the core building blocks of the framework. """ import math from copy import deepcopy import pandas as pd import numpy as np import cython as cy class Node(object): """ The Node is the main building block in bt's tree structure design. Both StrategyBase and SecurityBase inherit Node. It cont...
apache-2.0
MikeLing/shogun
examples/undocumented/python/graphical/interactive_svm_demo.py
6
12586
""" Shogun demo, based on PyQT Demo by Eli Bendersky Christian Widmer Soeren Sonnenburg License: GPLv3 """ import numpy import sys, os, csv from PyQt4.QtCore import * from PyQt4.QtGui import * import matplotlib from matplotlib.colorbar import make_axes, Colorbar from matplotlib.backends.backend_qt4agg import FigureCa...
gpl-3.0
jlcarmic/producthunt_simulator
venv/lib/python2.7/site-packages/scipy/integrate/odepack.py
62
9420
# Author: Travis Oliphant from __future__ import division, print_function, absolute_import __all__ = ['odeint'] from . import _odepack from copy import copy import warnings class ODEintWarning(Warning): pass _msgs = {2: "Integration successful.", 1: "Nothing was done; the integration time was 0.", ...
mit
blab/antibody-response-pulse
bcell-array/code/Virus_Bcell_IgM_IgG_Infection_OAS_new.py
1
13195
# coding: utf-8 # # Antibody Response Pulse # https://github.com/blab/antibody-response-pulse # # ### B-cells evolution --- cross-reactive antibody response after influenza virus infection or vaccination # ### Adaptive immune response for repeated infection # In[3]: ''' author: Alvason Zhenhua Li date: 04/09/201...
gpl-2.0
adhix11/pmtk3
python/demos/linregDemo1.py
26
1104
#!/usr/bin/python2.4 import numpy import scipy.stats import matplotlib.pyplot as plt def main(): # true parameters w = 2 w0 = 3 sigma = 2 # make data numpy.random.seed(1) Ntrain = 20 xtrain = numpy.linspace(0,10,Ntrain) ytrain = w*xtrain + w0 + numpy.random.random(Ntrain)*sigma ...
mit
marcusmueller/gnuradio
gr-filter/examples/fft_filter_ccc.py
7
4367
#!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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 3, or (at your option) # ...
gpl-3.0
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/sklearn/lda.py
3
9301
""" The :mod:`sklearn.lda` module implements Linear Discriminant Analysis (LDA). """ # Authors: Matthieu Perrot # Mathieu Blondel import warnings import numpy as np from scipy import linalg from .base import BaseEstimator, ClassifierMixin, TransformerMixin from .utils.extmath import logsumexp from .utils.fi...
agpl-3.0
grimfang/panda3d
samples/carousel/main.py
25
9571
#!/usr/bin/env python # Author: Shao Zhang, Phil Saltzman, and Eddie Canaan # Last Updated: 2015-03-13 # # This tutorial will demonstrate some uses for intervals in Panda # to move objects in your panda world. # Intervals are tools that change a value of something, like position, # rotation or anything else, linearly,...
bsd-3-clause
harisbal/pandas
pandas/core/tools/datetimes.py
4
30680
from functools import partial from datetime import datetime, time from collections import MutableMapping import numpy as np from pandas._libs import tslib, tslibs from pandas._libs.tslibs.strptime import array_strptime from pandas._libs.tslibs import parsing, conversion, Timestamp from pandas._libs.tslibs.parsing imp...
bsd-3-clause
ttthy1/2017sejongAI
week14/Mnist.py
1
2273
# Lab 7 Learning rate and Evaluation import tensorflow as tf import random import matplotlib.pyplot as plt tf.set_random_seed(777) # for reproducibility from tensorflow.examples.tutorials.mnist import input_data # Check out https://www.tensorflow.org/get_started/mnist/beginners for # more information about the mnist d...
gpl-3.0
jaidevd/scikit-learn
sklearn/externals/joblib/testing.py
23
3042
""" Helper for testing. """ import sys import warnings import os.path import re import subprocess import threading from sklearn.externals.joblib._compat import PY3_OR_LATER def warnings_to_stdout(): """ Redirect all warnings to stdout. """ showwarning_orig = warnings.showwarning def showwarning(msg...
bsd-3-clause
trungnt13/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
Micket/CCBuilder
make_cc.py
1
8680
#!/usr/bin/env python3 from __future__ import print_function from __future__ import division import argparse import pickle import time import CCBuilder as ccb import CCBuilder_c as ccb_c import numpy as np import scipy.special def uniform_dist(x): """ Returns uniform distributions of given range """ return la...
gpl-3.0
andersgs/dingo
dingo/random_forest.py
1
2551
''' Some functions to fit a random forest ''' import sklearn.ensemble import pandas import progressbar bar = progressbar.ProgressBar() def test_max_features(max_features): if (max_features not in ['sqrt', 'auto', 'log2', None]): try: max_features = int(max_features) except ValueError:...
bsd-3-clause
BlueBrain/NEST
testsuite/manualtests/cross_check_test_mip_corrdet.py
13
2594
# -*- coding: utf-8 -*- # # cross_check_test_mip_corrdet.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 o...
gpl-2.0
NicovincX2/Python-3.5
Algèbre/Opération/scalar_product.py
1
1933
# -*- coding: utf-8 -*- import os import seaborn seaborn.set() colors = seaborn.color_palette() import utils # For 3D plotting we need to import some extra stuff from mpl_toolkits.mplot3d import Axes3D # First create two random vectors in 3 dimensional space v1 = rand(3, 1) v2 = rand(3, 1) # And scale them to uni...
gpl-3.0
jcasner/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/path.py
69
20263
""" Contains a class for managing paths (polylines). """ import math from weakref import WeakValueDictionary import numpy as np from numpy import ma from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection, get_path_collection_extents, \ path_in_path, path_intersects_path, con...
agpl-3.0
giorgiop/scikit-learn
sklearn/linear_model/__init__.py
83
3139
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
bsd-3-clause
nik-hil/fastai
deeplearning2/rossman_exp.py
10
5451
train_ratio=0.9 use_dict=True use_scaler=False init_emb=False split_contins=True samp_size = 100000 #samp_size = 0 import math, keras, datetime, pandas as pd, numpy as np, keras.backend as K import matplotlib.pyplot as plt, xgboost, operator, random, pickle, os from sklearn_pandas import DataFrameMapper from sklearn.p...
apache-2.0
adiIspas/Machine-Learning_A-Z
Machine Learning A-Z/Part 7 - Natural Language Processing/Section 36 - Natural Language Processing/natural_language_processing.py
3
1452
# Natural Language Processing # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3) # Cleaning the texts import re import nltk nltk.download('stopwords') from nltk.corpus ...
mit
hsuantien/scikit-learn
sklearn/metrics/regression.py
23
16771
"""Metrics to assess performance on regression task 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.gramfort@inria.fr> # Ma...
bsd-3-clause
yunfeilu/scikit-learn
sklearn/decomposition/tests/test_sparse_pca.py
160
6028
# Author: Vlad Niculae # License: BSD 3 clause import sys import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing import ass...
bsd-3-clause
winklerand/pandas
pandas/tests/reshape/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
nomadcube/scikit-learn
examples/bicluster/plot_spectral_coclustering.py
276
1736
""" ============================================== A demo of the Spectral Co-Clustering algorithm ============================================== This example demonstrates how to generate a dataset and bicluster it using the the Spectral Co-Clustering algorithm. The dataset is generated using the ``make_biclusters`` f...
bsd-3-clause
tayebzaidi/snova_analysis
Miscellaneous/typ1a_features.py
1
2252
import matplotlib.pyplot as plt import scipy.interpolate as scinterp import numpy as np import peakfinding import peak_original import smoothing import plotter import random import readin import sys import os if __name__== '__main__': Mbdata = [] delM15data = [] path = "/Users/zaidi/Documents/REU/restframe...
gpl-3.0
billbrod/spatial-frequency-preferences
sfp/image_computable.py
1
6815
#!/usr/bin/python """code to help run the image-computable version of the model we're using this primarily to check the effect of vignetting, but this does make our project image-computable (though it's a linear model and so will fail in some trivial cases) """ import itertools import argparse import numpy as np impo...
mit
IshankGulati/scikit-learn
sklearn/feature_selection/variance_threshold.py
123
2572
# Author: Lars Buitinck # 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(BaseEstimator, SelectorMixin): ...
bsd-3-clause
Winand/pandas
pandas/tests/io/formats/test_eng_formatting.py
22
8085
import numpy as np import pandas as pd from pandas import DataFrame from pandas.compat import u import pandas.io.formats.format as fmt from pandas.util import testing as tm class TestEngFormatter(object): def test_eng_float_formatter(self): df = DataFrame({'A': [1.41, 141., 14100, 1410000.]}) fm...
bsd-3-clause
gmatteo/pymatgen
pymatgen/io/gaussian.py
2
59623
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module implements input and output processing from Gaussian. """ import re import warnings import numpy as np import scipy.constants as cst from monty.io import zopen from pymatgen.core.composition ...
mit
CalvinNeo/EasyMLPlatform
py/graphic/tree.py
1
4067
#coding:utf8 import numpy as np import math import pylab as pl import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import json class GraphTree: def __init__(self): self.jsonobj = {} self.leafNode = dict(boxstyle = 'roun...
apache-2.0
khiner/aubio
python/demos/demo_waveform_plot.py
10
2099
#! /usr/bin/env python import sys from aubio import pvoc, source from numpy import zeros, hstack def get_waveform_plot(filename, samplerate = 0, block_size = 4096, ax = None, downsample = 2**4): import matplotlib.pyplot as plt if not ax: fig = plt.figure() ax = fig.add_subplot(111) hop_s =...
gpl-3.0
Ziqi-Li/bknqgis
pandas/pandas/tests/io/test_packers.py
7
31902
import pytest from warnings import catch_warnings import os import datetime import numpy as np import sys from distutils.version import LooseVersion from pandas import compat from pandas.compat import u, PY3 from pandas import (Series, DataFrame, Panel, MultiIndex, bdate_range, date_range, period_...
gpl-2.0
jeffzheng1/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py
14
3569
# 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