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
mmadsen/sklearn-mmadsen
sklearn_mmadsen/dnn/dnnestimators.py
1
7032
#!/usr/bin/env python import numpy as np import pprint as pp from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.metrics import accuracy_score from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import SGD, Adam from keras.regularizers im...
apache-2.0
SANBI-SA/tools-iuc
tools/cwpair2/cwpair2_util.py
3
13741
import bisect import csv import os import sys import traceback import matplotlib matplotlib.use('Agg') from matplotlib import pyplot # noqa: I202,E402 # Data outputs DETAILS = 'D' MATCHED_PAIRS = 'MP' ORPHANS = 'O' # Data output formats GFF_EXT = 'gff' TABULAR_EXT = 'tabular' # Statistics historgrams output director...
mit
EricSB/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/mlab.py
69
104273
""" Numerical python functions written for compatability with matlab(TM) commands with the same names. Matlab(TM) compatible functions ------------------------------- :func:`cohere` Coherence (normalized cross spectral density) :func:`csd` Cross spectral density uing Welch's average periodogram :func:`detrend`...
agpl-3.0
crichardson17/starburst_atlas
Low_resolution_sims/Dusty_LowRes/Padova_inst/padova_inst_0/fullgrid/IR.py
30
9364
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
niltonlk/nest-simulator
pynest/nest/tests/test_spatial/test_spatial_distributions.py
7
30540
# -*- coding: utf-8 -*- # # test_spatial_distributions.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 of ...
gpl-2.0
nickgentoo/scikit-learn-graph
scripts/Keras_deep_calculate_cv_allkernels.py
1
11280
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 13:02:41 2015 Copyright 2015 Nicolo' Navarin This file is part of scikit-learn-graph. scikit-learn-graph 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 ...
gpl-3.0
murphy214/berrl
berrl/pipewidgets.py
2
31866
''' Module: pipehtml.py A module to parse html for data in static html and for data to be updated in real time. Created by: Bennett Murphy email: murphy214@marshall.edu ''' import json import itertools import os from IPython.display import IFrame import ipywidgets as widgets from math import floor import numpy as np...
apache-2.0
hsiaoyi0504/scikit-learn
sklearn/metrics/cluster/unsupervised.py
230
8281
""" Unsupervised evaluation metrics. """ # Authors: Robert Layton <robertlayton@gmail.com> # # License: BSD 3 clause import numpy as np from ...utils import check_random_state from ..pairwise import pairwise_distances def silhouette_score(X, labels, metric='euclidean', sample_size=None, random...
bsd-3-clause
IDSIA/sacred
sacred/optional.py
1
1570
#!/usr/bin/env python # coding=utf-8 import importlib from sacred.utils import modules_exist from sacred.utils import get_package_version, parse_version def optional_import(*package_names): try: packages = [importlib.import_module(pn) for pn in package_names] return True, packages[0] except I...
mit
ilyes14/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
theoryno3/pylearn2
pylearn2/cross_validation/tests/test_train_cv_extensions.py
49
1681
""" Tests for TrainCV extensions. """ import os import tempfile from pylearn2.config import yaml_parse from pylearn2.testing.skip import skip_if_no_sklearn def test_monitor_based_save_best_cv(): """Test MonitorBasedSaveBestCV.""" handle, filename = tempfile.mkstemp() skip_if_no_sklearn() trainer = ya...
bsd-3-clause
Mecanon/morphing_wing
experimental/comparison_model/actuator.py
5
15329
# -*- coding: utf-8 -*- """ Created on Fri Apr 15 17:27:40 2016 @author: Pedro Leal """ import math from scipy.optimize import newton import numpy as np import matplotlib.pyplot as plt class actuator(): """ Actuator object where inputs: - -(n): is a dictionary with keys 'x' and 'y', the coordinates of ...
mit
mbkumar/pymatgen
pymatgen/util/tests/test_plotting.py
4
1230
import unittest from pymatgen.util.plotting import periodic_table_heatmap, van_arkel_triangle from pymatgen.util.testing import PymatgenTest import matplotlib class FuncTestCase(PymatgenTest): def test_plot_periodic_heatmap(self): random_data = {'Te': 0.11083818874391202, 'Au': 0.7575629917425387, ...
mit
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/preprocessing/data.py
1
67256
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # Giorgio Patrini <giorgio.patrini@anu.edu.au> # Lic...
mit
fbagirov/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
znes/HESYSOPT
hesysopt/restore_results.py
1
1428
# -*- coding: utf-8 -*- """ This module is used to configure the plotting. At the momemt it reads for the default all results path and creates a multiindex dataframe. This is used by the different plotting-modules. Also, colors are set here. Note: This is rather ment to illustrate, how hesysopt results can be plotted...
gpl-3.0
ccauet/scikit-optimize
benchmarks/bench_ml.py
1
15685
""" This code implements benchmark for the black box optimization algorithms, applied to a task of optimizing parameters of ML algorithms for the task of supervised learning. The code implements benchmark on 4 datasets where parameters for 6 classes of supervised models are tuned to optimize performance on datasets. ...
bsd-3-clause
datapythonista/pandas
pandas/tests/series/methods/test_dropna.py
2
3488
import numpy as np import pytest from pandas import ( DatetimeIndex, IntervalIndex, NaT, Period, Series, Timestamp, ) import pandas._testing as tm class TestDropna: def test_dropna_empty(self): ser = Series([], dtype=object) assert len(ser.dropna()) == 0 return_va...
bsd-3-clause
ivastar/clear
grizli_reduction.py
1
33227
#!/home/rsimons/miniconda2/bin/python import matplotlib import time import os import numpy as np import matplotlib.pyplot as plt from astropy.io import fits import drizzlepac import grizli import glob from grizli import utils import importlib from grizli.prep import process_direct_grism_visit #from hsaquery import quer...
mit
mhue/scikit-learn
sklearn/utils/graph.py
289
6239
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
xavierwu/scikit-learn
examples/ensemble/plot_forest_importances_faces.py
403
1519
""" ================================================= Pixel importances with a parallel forest of trees ================================================= This example shows the use of forests of trees to evaluate the importance of the pixels in an image classification task (faces). The hotter the pixel, the more impor...
bsd-3-clause
ashtonwebster/tl_algs
tests/test_trbag.py
1
2668
# coding: utf-8 import pandas as pd from sklearn.datasets.samples_generator import make_blobs from sklearn.ensemble import RandomForestClassifier import random from tl_algs import peters, weighted, trbag, tl_baseline, burak RAND_SEED = 2016 random.seed(RAND_SEED) # change this to see new random data! # randomly gen...
mit
mbeyeler/pulse2percept
pulse2percept/datasets/nanduri2012.py
1
3284
"""`load_nanduri2012`""" from os.path import dirname, join import numpy as np try: import pandas as pd has_pandas = True except ImportError: has_pandas = False def load_nanduri2012(electrodes=None, task=None, shuffle=False, random_state=0): """Load data from [Nanduri2012]_ Load the threshold dat...
bsd-3-clause
CforED/Machine-Learning
examples/neighbors/plot_regression.py
349
1402
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@...
bsd-3-clause
google-research/google-research
xirl/xirl/evaluators/emb_visualizer.py
1
2628
# 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
zycdragonball/tensorflow
tensorflow/python/estimator/canned/dnn_test.py
20
16058
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
calebfoss/tensorflow
tensorflow/contrib/learn/python/learn/estimators/__init__.py
6
11427
# 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
meduz/scikit-learn
benchmarks/bench_glmnet.py
111
3890
""" To run this, you'll need to have installed. * glmnet-python * scikit-learn (of course) Does two benchmarks First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of...
bsd-3-clause
themrmax/scikit-learn
examples/feature_selection/plot_feature_selection_pipeline.py
58
1049
""" ================== Pipeline Anova SVM ================== Simple usage of Pipeline that runs successively a univariate feature selection with anova and then a C-SVM of the selected features. """ from sklearn import svm from sklearn.datasets import samples_generator from sklearn.feature_selection import SelectKBest,...
bsd-3-clause
kirel/political-affiliation-prediction
partyprograms.py
2
3428
# -*- coding: utf-8 -*- import re import cPickle from classifier import Classifier import json from scipy import ones,argmax from sklearn.metrics import classification_report,confusion_matrix def partyprograms(folder='model'): clf = Classifier(folder=folder) # converted with pdftotext text = {} bow = {...
mit
yask123/scikit-learn
examples/cluster/plot_mean_shift.py
351
1793
""" ============================================= A demo of the mean-shift clustering algorithm ============================================= Reference: Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward feature space analysis". IEEE Transactions on Pattern Analysis and Machine Intelligence. 2002. ...
bsd-3-clause
wazeerzulfikar/scikit-learn
sklearn/learning_curve.py
8
15418
"""Utilities to evaluate models with respect to a variable """ # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings import numpy as np from .base import is_classifier, clone from .cross_validation import check_cv from .externals.joblib import Parallel, delayed fro...
bsd-3-clause
okadate/romspy
romspy/tplot/tplot_param.py
1
4044
# coding: utf-8 # (c) 2016-01-27 Teruhisa Okada import netCDF4 import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter from matplotlib.offsetbox import AnchoredText import numpy as np import pandas as pd import glob import romspy def tplot_param(inifiles, vname, ax=plt.gca()): for inifile in i...
mit
sebalander/trilateration
trilatera.py
1
11639
''' practicar trilateracion ''' # %% import numpy as np import numpy.linalg as ln import matplotlib.pyplot as plt import numdifftools as ndf from scipy.special import chdtri # %% kml_file = "/home/sebalander/Code/VisionUNQextra/trilateration/trilat.kml" # %% texto = open(kml_file, 'r').read() names = list() data...
gpl-2.0
mjgrav2001/scikit-learn
sklearn/metrics/ranking.py
75
25426
"""Metrics to assess performance on classification task given scores 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....
bsd-3-clause
ssaeger/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
AdityaSoni19031997/Machine-Learning
Classifying_datasets/MNIST/neural_networks.py
1
4282
''' Using ANN Classifying Handwritten Digits My first attempt to build a neural network....for evaluating the famous MNIST Digit Classification" -Aditya Soni ''' #Import Statements import numpy as np # for fast calculations import matplotlib.pyplot as plt # for plotiing import scipy.special # for sigmoid f...
mit
godrayz/trading-with-python
lib/csvDatabase.py
77
6045
# -*- coding: utf-8 -*- """ intraday data handlers in csv format. @author: jev """ from __future__ import division import pandas as pd import datetime as dt import os from extra import ProgressBar dateFormat = "%Y%m%d" # date format for converting filenames to dates dateTimeFormat = "%Y%m%d %H:%M:%S"...
bsd-3-clause
madjelan/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
387
2060
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow thes...
bsd-3-clause
cgre-aachen/gempy
gempy/utils/extract_geomodeller_data.py
1
9895
from pylab import * import copy import pandas as pn import gempy as gp import numpy as np try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET class ReadGeoModellerXML: def __init__(self, fp): """ Reads in and parses a GeoModeller XML file to ex...
lgpl-3.0
followthesheep/galpy
galpy/snapshot_src/Snapshot.py
2
13530
import numpy as nu from galpy.orbit import Orbit from galpy.potential_src.planarPotential import RZToplanarPotential import galpy.util.bovy_plot as plot from directnbody import direct_nbody class Snapshot(object): """General snapshot = collection of particles class""" def __init__(self,*args,**kwargs): ...
bsd-3-clause
mjvakili/gambly
code/tests/test_data.py
1
5063
''' testing how the model fits the data ''' from __future__ import (division, print_function, absolute_import, unicode_literals) import numpy as np import matplotlib.pyplot as plt import os.path as path import time from Corrfunc import _countpairs from Corrfunc.utils import read_catalog # --- Lo...
mit
nvoron23/scikit-learn
sklearn/grid_search.py
61
37197
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
marcocaccin/scikit-learn
sklearn/svm/classes.py
6
40597
import warnings import numpy as np from .base import _fit_liblinear, BaseSVC, BaseLibSVM from ..base import BaseEstimator, RegressorMixin from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \ LinearModel from ..feature_selection.from_model import _LearntSelectorMixin from ..utils import check_X...
bsd-3-clause
mikeireland/opticstools
playground/nuller_with_phase.py
1
1258
""" The CSV input files came from WebPlotDigitizer and Harry's plots. """ import numpy as np import matplotlib.pyplot as plt import scipy.optimize as op imbalance = np.genfromtxt('harry_imbalance.csv', delimiter=',') phase_deg = np.genfromtxt('harry_phase.csv', delimiter=',') #Wavelength range wave = np.linspace(3.7,...
mit
henrykironde/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = ...
bsd-3-clause
plissonf/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
jmorton/yatsm
yatsm/classifiers/diagnostics.py
1
7252
import logging import numpy as np import scipy.ndimage from sklearn.utils import check_random_state # from sklearn.cross_validation import KFold, StratifiedKFold logger = logging.getLogger('yatsm') def kfold_scores(X, y, algo, kf_generator): """ Performs KFold crossvalidation and reports mean/std of scores ...
mit
certik/hermes1d
examples/system_neutronics_fixedsrc2/plot.py
3
1210
import matplotlib.pyplot as plt import numpy as np # material data Q = [0.0, 1.5, 1.8, 1.5, 1.8, 1.8, 1.5] D1 = 7*[1.2] D2 = 7*[0.4] S1 = 7*[0.03] S2 = [0.1, 0.2, 0.25, 0.2, 0.25, 0.25, 0.2] S12= [0.02] + 6*[0.015] nSf1 = [0.005] + 6*[0.0075] nSf2 = 7*[0.1] fig = plt.figure() # one axes for each group ax1 = fig.ad...
bsd-3-clause
makelove/OpenCV-Python-Tutorial
ch15-图像阈值/15.简单阈值threshold.py
1
1439
# -*- coding: utf-8 -*- ''' 简单阈值 像素值高于阈值时 我们给这个像素 赋予一个新值, 可能是白色 , 否则我们给它赋予另外一种颜色, 或是黑色 。 这个函数就是 cv2.threshhold()。 这个函数的第一个参数就是原图像 原图像应 是灰度图。 第二个参数就是用来对像素值进行分类的阈值。 第三个参数 就是当像素值高于, 有时是小于 阈值时应该被赋予的新的像素值。 OpenCV 提供了多种不同的阈值方法 , 是由第四个参数来决定的。 些方法包括 • cv2.THRESH_BINARY • cv2.THRESH_BINARY_INV • cv2.THRESH_TRUNC • cv2...
mit
nmayorov/scikit-learn
sklearn/utils/tests/test_murmurhash.py
65
2838
# 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 nose.tools import assert_equa...
bsd-3-clause
pystockhub/book
ch18/day03/Kiwoom.py
2
8383
import sys from PyQt5.QtWidgets import * from PyQt5.QAxContainer import * from PyQt5.QtCore import * import time import pandas as pd import sqlite3 TR_REQ_TIME_INTERVAL = 0.2 class Kiwoom(QAxWidget): def __init__(self): super().__init__() self._create_kiwoom_instance() self._set_signal_sl...
mit
mattjj/pyhsmm-factorial
example.py
2
2924
from __future__ import division import numpy as np np.seterr(divide='ignore') from matplotlib import pyplot as plt import pyhsmm from pyhsmm.util.text import progprint_xrange import models import util as futil T = 400 Nmax = 10 # observation distributions used to generate data true_obsdistns_chain1 = [ pyhs...
mit
wood-b/CompBook
project1/sectD/ete_hist.py
2
1207
import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab from scipy import stats __author__ = "Brandon Wood" file = open(sys.argv[1]) HEADER_LINES = 0 for x in range(HEADER_LINES): file.readline() ete_list = [] for line in file: tokens = line.split() ete_list.append(f...
bsd-3-clause
joshloyal/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
moonbury/pythonanywhere
github/MasteringMLWithScikit-learn/8365OS_07_Codes/pca-3d-plot.py
3
1392
import matplotlib matplotlib.use('Qt4Agg') import numpy as np import pylab as pl from mpl_toolkits.mplot3d import Axes3D from sklearn import decomposition from sklearn import datasets np.random.seed(5) centers = [[1, 1], [-1, -1], [1, -1]] iris = datasets.load_iris() X = iris.data y = iris.target fig = pl.figure(...
gpl-3.0
meduz/scikit-learn
examples/ensemble/plot_forest_iris.py
335
6271
""" ==================================================================== Plot the decision surfaces of ensembles of trees on the iris dataset ==================================================================== Plot the decision surfaces of forests of randomized trees trained on pairs of features of the iris dataset. ...
bsd-3-clause
ky822/scikit-learn
examples/linear_model/plot_sparse_recovery.py
243
7461
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
heplesser/nest-simulator
pynest/examples/spatial/ctx_2n.py
20
2192
# -*- coding: utf-8 -*- # # ctx_2n.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 of the License, or # (a...
gpl-2.0
lilleswing/deepchem
deepchem/data/datasets.py
1
99890
""" Contains wrapper class for datasets. """ import json import os import math import random import logging import tempfile import time import shutil import multiprocessing from ast import literal_eval as make_tuple from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Tuple, Union import numpy a...
mit
tom-f-oconnell/multi_tracker
scripts/hdf5_to_csv.py
1
1208
#!/usr/bin/env python from __future__ import print_function from os.path import join, splitext import glob import pandas as pd #import matplotlib.pyplot as plt import multi_tracker_analysis as mta def main(): #experiment_dir = 'choice_20210129_162648' experiment_dir = '.' def find_file_via_suffix(suf...
mit
ml-lab/neuralnilm
neuralnilm/data/stridesource.py
4
6512
from __future__ import print_function, division from copy import copy from datetime import timedelta import numpy as np import pandas as pd import nilmtk from nilmtk.timeframegroup import TimeFrameGroup from nilmtk.timeframe import TimeFrame from neuralnilm.data.source import Sequence from neuralnilm.utils import check...
apache-2.0
cduvedi/CS229-project
feature_extraction/eigen_faces_refactored.py
1
5401
import os import csv import numpy import scipy import random import pylab as pl from scipy import linalg from scipy.misc import toimage from sklearn.cross_validation import train_test_split from sklearn.datasets import fetch_lfw_people from sklearn.grid_search import GridSearchCV from sklearn.metrics import classifica...
gpl-2.0
sgrieve/LH_Paper_Plotting
Plotting_Code/Figure_8_revision.py
1
5620
# -*- coding: utf-8 -*- """ Copyright (C) 2015 Stuart W.D Grieve 2015 Developer can be contacted by s.grieve _at_ ed.ac.uk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the Lic...
gpl-2.0
arcyfelix/Machine-Learning-For-Trading
34_correlation.py
1
2422
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt ''' Read: http://pandas.pydata.org/pandas-docs/stable/api.html#api-dataframe-stats ''' def symbol_to_path(symbol, base_dir = 'data'): return os.path.join(base_dir, "{}.csv".format(str(symbol))) def dates_creator(): ...
apache-2.0
nhejazi/scikit-learn
sklearn/manifold/t_sne.py
3
35216
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # Author: Christopher Moody <chrisemoody@gmail.com> # Author: Nick Travers <nickt@squareup.com> # License: BSD 3 clause (C) 2014 # This is the exact and Barnes-Hut t-SNE implementation. There are other # modifications of the algorithm: # * Fast Optimi...
bsd-3-clause
ilyes14/scikit-learn
sklearn/cluster/tests/test_hierarchical.py
230
19795
""" Several basic tests for hierarchical clustering procedures """ # Authors: Vincent Michel, 2010, Gael Varoquaux 2012, # Matteo Visconti di Oleggio Castello 2014 # License: BSD 3 clause from tempfile import mkdtemp import shutil from functools import partial import numpy as np from scipy import sparse from...
bsd-3-clause
julienmalard/Tinamit
tinamit/geog/mapa.py
1
14476
import os import matplotlib.pyplot as dib import numpy as np import shapefile as sf from matplotlib import colors, cm from matplotlib.axes import Axes from matplotlib.backends.backend_agg import FigureCanvasAgg as TelaFigura from matplotlib.figure import Figure as Figura from tinamit.config import _ from ..mod import...
gpl-3.0
IndraVikas/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
fnielsen/dasem
dasem/data.py
1
1750
"""Data. Functions to read datasets from the data subdirectory. """ from os.path import join, split from pandas import read_csv def four_words(): """Read and return four words odd-one-out dataset. Returns ------- >>> df = four_words() >>> df.ix[0, 'word4'] == 'stol' True """ file...
apache-2.0
chrisburr/scikit-learn
sklearn/tests/test_kernel_approximation.py
244
7588
import numpy as np from scipy.sparse import csr_matrix from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_almost_equal, assert_raises from sklearn.utils.testing import assert_less_equal from ...
bsd-3-clause
hugobowne/scikit-learn
examples/cluster/plot_face_segmentation.py
71
2839
""" =================================================== Segmenting the picture of a raccoon face in regions =================================================== This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous...
bsd-3-clause
ulisespereira/LearningSequences
Plasticity/popModel/sequence_norm_bf_adaptation.py
1
5722
import numpy as np from scipy import sparse from scipy.integrate import odeint import matplotlib.pyplot as plt import math as mt from stimulus import * from myintegrator import * import cProfile import json # this is the transfer function def phi(x,theta,uc): myresult=nu*(x-theta) myresult[x<theta]=0. myresult[x>uc...
gpl-2.0
justincassidy/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
0todd0000/spm1d
spm1d/examples/nonparam/1d/roi/ex_anova2.py
1
1477
import numpy as np from matplotlib import pyplot import spm1d #(0) Load dataset: dataset = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_2x2() # dataset = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_2x3() # dataset = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_3x3() # dataset = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_3x4() ...
gpl-3.0
ZenDevelopmentSystems/scikit-learn
examples/linear_model/plot_ridge_path.py
254
1655
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== Shows the effect of collinearity in the coefficients of an estimator. .. currentmodule:: sklearn.linear_model :class:`Ridge` Regressi...
bsd-3-clause
Ghalko/osf.io
scripts/analytics/utils.py
30
1244
# -*- coding: utf-8 -*- import os import unicodecsv as csv from bson import ObjectId import matplotlib.pyplot as plt import matplotlib.dates as mdates import requests from website import util def oid_to_datetime(oid): return ObjectId(oid).generation_time def mkdirp(path): try: os.makedirs(path) ...
apache-2.0
vovojh/gem5
util/stats/barchart.py
90
12472
# Copyright (c) 2005-2006 The Regents of The University of Michigan # 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, this ...
bsd-3-clause
caidongyun/pylearn2
pylearn2/scripts/datasets/browse_norb.py
44
15741
#!/usr/bin/env python """ A browser for the NORB and small NORB datasets. Navigate the images by choosing the values for the label vector. Note that for the 'big' NORB dataset, you can only set the first 5 label dimensions. You can then cycle through the 3-12 images that fit those labels. """ import sys import os imp...
bsd-3-clause
ChanderG/scikit-learn
benchmarks/bench_plot_fastkmeans.py
294
4676
from __future__ import print_function from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chun...
bsd-3-clause
happyx2/asspy
asspy/lexrank.py
1
6324
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import getopt import codecs import collections import numpy import networkx import re from sklearn.feature_extraction import DictVectorizer from sklearn.metrics import pairwise_distances import tools from misc.divrank import divrank, divrank_scipy from nltk.tok...
mit
manpen/hypergen
libs/NetworKit/scripts/DynamicBetweennessExperiments_fixed_batch.py
3
4514
from networkit import * from networkit.dynamic import * from networkit.centrality import * import pandas as pd import random def isConnected(G): cc = properties.ConnectedComponents(G) cc.run() return (cc.numberOfComponents() == 1) def removeAndAddEdges(G, nEdges, tabu=None): if nEdges > G.numberOfEdges() - tabu....
gpl-3.0
rahlk/RAAT
src/tools/Discretize.py
2
4964
""" An instance filter that discretizes a range of numeric attributes in the dataset into nominal attributes. Discretization is by Fayyad & Irani's MDL method (the default). For more information, see: Usama M. Fayyad, Keki B. Irani: Multi-interval discretization of continuous valued attributes for classification lear...
mit
theoryno3/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
hadmack/pyoscope
tests/display_rigol.py
1
1116
#!/usr/bin/env python # # PyUSBtmc # display_channel.py # # Copyright (c) 2011 Mike Hadmack # Copyright (c) 2010 Matt Mets # This code is distributed under the MIT license # # This script is just to test rigolscope functionality as a module # import numpy from matplotlib import pyplot import sys import os sys.path.app...
mit
dorianprill/CBIRjpg
plot.py
1
5140
#!/usr/bin/python3 import pickle import matplotlib import argparse from itertools import product matplotlib.use("Agg") import matplotlib.pyplot as plt matplotlib.style.use("ggplot") matplotlib.rcParams.update({"font.size" : 10}) def getAvailableValues(parameter): return sorted(list(set(r[parameter] for r in res...
gpl-3.0
jasonfrowe/Kepler
example/transitfit5.py
1
11384
import numpy as np from numpy import zeros from numpy import ones import tfit5 import fittransitmodel as ftf import matplotlib #ploting matplotlib.use("Agg") import matplotlib.pyplot as plt import math #used for floor command def readtt(*files): "reading in TT files" nmax=0 #we will first scan through the...
gpl-3.0
nwjs/chromium.src
tools/perf/core/external_modules.py
10
1614
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Allow importing external modules which may be missing in some platforms. These modules are normally provided by the vpython environment manager. But some...
bsd-3-clause
mbkumar/pymatgen
dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py
5
15844
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Script to visualize the model coordination environments """ __author__ = "David Waroquiers" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "2.0" __maintainer__ = "David Waroquiers" _...
mit
nojero/pod
src/neg/units.py
1
7695
#!/usr/bin/python from net import * from z3 import * from time import time from matrix import * import pandas as pd def z3Pair(x,y): assert(isinstance(x, Place) and isinstance(y, Place)) return Int(str(repr(x)) + "-" + str(repr(y))) def z3Int(x): assert(isinstance(x, Place)) return Int(...
gpl-3.0
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/tests/series/test_replace.py
8
7896
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import numpy as np import pandas as pd import pandas.lib as lib import pandas.util.testing as tm from .common import TestData class TestSeriesReplace(TestData, tm.TestCase): _multiprocess_can_split_ = True def test_replace(self): N = 100 ser...
gpl-3.0
castelao/CoTeDe
tests/qctests/test_qc_gradient.py
1
1641
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ """ import numpy as np from numpy import ma from cotede.qctests.gradient import curvature, _curvature_pandas from cotede.qctests import Gradient from ..data import DummyData from .compare import compare_feature_input_types, ...
bsd-3-clause
dreadjesus/MachineLearning
NaturalLanguageProcessing/ham_spam.py
1
2700
import nltk # nltk.download_shell() import pandas as pd import string from nltk.corpus import stopwords # words like: the, me, our from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.naive_bayes import MultinomialNB from sklearn.metrics...
mit
fabioticconi/scikit-learn
examples/linear_model/plot_sparse_recovery.py
70
7486
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
ssamot/ce888
labs/lab2/salaries.py
1
1518
import matplotlib matplotlib.use('Agg') import pandas as pd import random import matplotlib.pyplot as plt import seaborn as sns import numpy as np # def permutation(statistic, error): def mad(arr): """ Median Absolute Deviation: a "Robust" version of standard deviation. Indices variabililty of the ...
gpl-3.0
dancingdan/tensorflow
tensorflow/examples/get_started/regression/imports85.py
41
6589
# 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
huzq/scikit-learn
examples/model_selection/plot_nested_cross_validation_iris.py
23
4413
""" ========================================= Nested versus non-nested cross-validation ========================================= This example compares non-nested and nested cross-validation strategies on a classifier of the iris data set. Nested cross-validation (CV) is often used to train a model in which hyperparam...
bsd-3-clause
xhqu1981/pymatgen
pymatgen/analysis/eos.py
5
17394
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import unicode_literals, division, print_function """ This module implements various equation of states. Note: Most of the code were initially adapted from ASE and deltafactor by @gmatteo but ...
mit
huongttlan/statsmodels
statsmodels/examples/ex_kde_confint.py
34
1973
# -*- coding: utf-8 -*- """ Created on Mon Dec 16 11:02:59 2013 Author: Josef Perktold """ from __future__ import print_function import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.nonparametric.api as npar from statsmodels.sandbox.nonparametric import kernels from statsmode...
bsd-3-clause
davidam/python-examples
scikit/lda.py
2
4035
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2018 David Arroyo Menéndez # Author: David Arroyo Menéndez <davidam@gnu.org> # Maintainer: David Arroyo Menéndez <davidam@gnu.org> # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as p...
gpl-3.0