repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
StuntsPT/pyRona
setup.py
1
2535
#!/usr/bin/python3 # Copyright 2017-2020 Francisco Pina Martins <f.pinamartins@gmail.com> # This file is part of pyRona. # pyRona 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 of the Licens...
gpl-3.0
jundongl/PyFeaST
skfeature/function/sparse_learning_based/MCFS.py
3
2089
import scipy import numpy as np from sklearn import linear_model from skfeature.utility.construct_W import construct_W def mcfs(X, n_selected_features, **kwargs): """ This function implements unsupervised feature selection for multi-cluster data. Input ----- X: {numpy array}, shape (n_samples, n_...
gpl-2.0
andrewnc/scikit-learn
sklearn/linear_model/__init__.py
270
3096
""" 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
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/sklearn/datasets/species_distributions.py
64
7917
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
gpl-2.0
harishkrao/Python-for-Data-Analysis
chapter 07/analysis.py
4
2414
from pandas import * from pandas.util.decorators import cache_readonly import numpy as np import os base = 'ml-100k' class IndexedFrame(object): """ """ def __init__(self, frame, field): self.frame = frame def _build_index(self): pass class Movielens(object): def __init__(self...
mit
glorizen/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py
69
20664
from __future__ import division import math import os import sys import matplotlib from matplotlib import verbose from matplotlib.cbook import is_string_like, onetrue from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \ FigureManagerBase, FigureCanvasBase, NavigationToolbar2, IdleEvent, curso...
agpl-3.0
proto-n/Alpenglow
python/alpenglow/OnlineExperiment.py
1
11711
from .Getter import Getter as rs from .utils.DataframeData import DataframeData from .ParameterDefaults import ParameterDefaults import pandas as pd import alpenglow.sip as sip class OnlineExperiment(ParameterDefaults): """OnlineExperiment(seed=254938879,top_k=100) This is the base class of every online exper...
apache-2.0
coldmanck/fast-rcnn
tools/train_svms.py
3
13479
#!/usr/bin/env python # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """ Train post-hoc SVMs using the algorithm and ...
mit
zlongshen/InertialNav
code/plot_glitchOffset.py
6
3806
#!/bin/python import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.cbook as cbook import numpy as np import math # timestamp, velN, velE, velD, posN, posE, posOffN, posOffE, velOffN, velOffE data = np.genfromtxt('GlitchOffsetOut.txt', delimiter=' ', skip_header=1, skip_footer=1, names=['time', ...
bsd-3-clause
datacommonsorg/data
scripts/india_census/primary_census_abstract_houseless_population/preprocess.py
1
3249
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
themrmax/scikit-learn
examples/model_selection/plot_nested_cross_validation_iris.py
46
4415
""" ========================================= 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
xiaoxiamii/scikit-learn
examples/linear_model/plot_sgd_weighted_samples.py
344
1458
""" ===================== SGD: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model # we create 20 points np.random.seed(0) X ...
bsd-3-clause
robin-lai/scikit-learn
sklearn/ensemble/tests/test_partial_dependence.py
365
6996
""" Testing for the partial dependence module. """ import numpy as np from numpy.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import if_matplotlib from sklearn.ensemble.partial_dependence import partial_dependence from sklearn.ensemble.partial_dependence...
bsd-3-clause
kaichogami/scikit-learn
examples/semi_supervised/plot_label_propagation_structure.py
45
2433
""" ============================================== Label Propagation learning a complex structure ============================================== Example of LabelPropagation learning a complex internal structure to demonstrate "manifold learning". The outer circle should be labeled "red" and the inner circle "blue". Be...
bsd-3-clause
wasade/qiime
setup.py
1
9528
#!/usr/bin/env python # File created on 17 Feb 2010 from __future__ import division from setuptools import setup from stat import S_IEXEC from os import (chdir, getcwd, listdir, chmod, walk, rename, remove, chmod, stat, devnull) from os.path import join, abspath from sys import platform, argv from subpr...
gpl-2.0
rrohan/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
florian-f/sklearn
examples/ensemble/plot_forest_multioutput.py
4
2004
""" ========================================= Face completion with multi-output forests ========================================= This example shows the use of multi-output forests to complete images. The goal is to predict the lower half of a face given its upper half. The first row of images shows true faces. The s...
bsd-3-clause
wolfiex/DSMACC-testing
dsmacc/examples/spectral_embedding_.py
1
22572
"""Spectral Embedding""" # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Wei LI <kuantkid@gmail.com> # License: BSD 3 clause #import warnings class warnings:None warnings.warn=lambda x:1 import warnings import numpy as np from scipy import sparse from scipy.linalg import eigh from scipy.sparse....
gpl-3.0
mattgiguere/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
cython-testbed/pandas
pandas/tests/frame/test_asof.py
4
4662
# coding=utf-8 import numpy as np import pytest from pandas import (DataFrame, date_range, Timestamp, Series, to_datetime) import pandas.util.testing as tm from .common import TestData class TestFrameAsof(TestData): def setup_method(self, method): self.N = N = 50 self.rng = ...
bsd-3-clause
shubhomoydas/pyaad
pyalad/data_plotter.py
1
3636
import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import matplotlib.markers from r_support import cbind class DataPlotter(object): """Encapsulates the layout of PDF plots The PDF will have a grid layout of rows x cols subplots. When a new plot is adde...
mit
feranick/SpectralMachine
Archive/SpectraLearnPredict/SpectraLearnPredict/slp/slp_kmeans.py
1
3607
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' ********************************************************** * * SpectraLearnPredict - kmeans * Perform Machine Learning on Spectroscopy Data. * * Uses: Deep Neural Networks, TensorFlow, SVM, PCA, K-Means * * By: Nicola Ferralis <feranick@hotmail.com> * *****************...
gpl-3.0
pratapvardhan/scikit-learn
examples/ensemble/plot_isolation_forest.py
65
2363
""" ========================================== 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
ezekial4/atomic_neu
examples/rate_equations.py
1
1649
import numpy as np import matplotlib.pyplot as plt import atomic.atomic as atomic ad = atomic.element('carbon') temperature = np.logspace(0, 3, 50) density = 1e20 tau = 1e20 / density t_normalized = np.logspace(-7, 0, 50) t_normalized -= t_normalized[0] times = t_normalized * tau rt = atomic.RateEquations(ad) yy =...
mit
dvro/imbalanced-learn
examples/under-sampling/plot_random_under_sampler.py
3
1918
""" ===================== Random under-sampling ===================== An illustration of the random under-sampling method. """ print(__doc__) import matplotlib.pyplot as plt import seaborn as sns sns.set() # Define some color for the plotting almost_black = '#262626' palette = sns.color_palette() from sklearn.dat...
mit
mne-tools/mne-tools.github.io
0.14/_downloads/plot_stats_spatio_temporal_cluster_sensors.py
3
7514
""" .. _stats_cluster_sensors_2samp_spatial: ===================================================== Spatiotemporal permutation F-test on full sensor data ===================================================== Tests for differential evoked responses in at least one condition using a permutation clustering test. The Fiel...
bsd-3-clause
bjornsturmberg/NumBAT
lit_examples/simo-lit_06_2-Florez-NatComm_2016-d1160nm.py
1
3419
""" Replicating the results of Brillouin scattering self-cancellation Florez et al. http://dx.doi.org/10.1038/ncomms11759 """ import time import datetime import numpy as np import sys import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt sys.path.append("../backend/") import materials im...
gpl-3.0
JosmanPS/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
bassio/omicexperiment
omicexperiment/transforms/filters/sample.py
1
1678
import pandas as pd from omicexperiment.transforms.transform import Filter, AttributeFilter, GroupByTransform, FlexibleOperatorMixin, AttributeFlexibleOperatorMixin, TransformObjectsProxy from omicexperiment.transforms.sample import SampleGroupBy, SampleSumCounts class SampleMinCount(Filter): def __dapply__(self,...
bsd-3-clause
ehogan/iris
docs/iris/example_code/General/SOI_filtering.py
6
3196
""" Applying a filter to a time-series ================================== This example demonstrates low pass filtering a time-series by applying a weighted running mean over the time dimension. The time-series used is the Darwin-only Southern Oscillation index (SOI), which is filtered using two different Lanczos filt...
lgpl-3.0
FrederikDiehl/apsis
code/apsis/assistants/experiment_assistant.py
2
16607
__author__ = 'Frederik Diehl' from apsis.models.experiment import Experiment from apsis.models.candidate import Candidate from apsis.utilities.optimizer_utils import check_optimizer from apsis.utilities.file_utils import ensure_directory_exists import numpy as np import datetime import os import time from apsis.utilit...
mit
rahul-c1/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
ThorJonsson/IceTourists
HelpFunctions.py
3
3361
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import shapefile import bokeh.plotting as bpl import matplotlib.cm as mpc import pdb import matplotlib.pyplot as plt # read the shapefile and initialize the map def initialize_map(filename, plot_width): # Read the shapefile dat = shapefile.Reader...
gpl-2.0
kiran/bart-sign
venv/lib/python2.7/site-packages/numpy/lib/function_base.py
14
134708
from __future__ import division, absolute_import, print_function import warnings import sys import collections import operator import numpy as np import numpy.core.numeric as _nx from numpy.core import linspace, atleast_1d, atleast_2d from numpy.core.numeric import ( ones, zeros, arange, concatenate, array, asarr...
mit
pizzathief/scipy
scipy/ndimage/fourier.py
8
11239
# Copyright (C) 2003-2005 Peter J. Verveer # # 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 list of conditions and the following d...
bsd-3-clause
janvanrijn/openml-pimp
examples/animation/generate_priors_example.py
1
9181
import argparse import matplotlib.pyplot as plt import matplotlib.animation import matplotlib.patches import numpy as np import os import openml import pickle import scipy.stats def parse_args(): parser = argparse.ArgumentParser(description='Generate svm boundary gif') # output file related parser.add_arg...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
221
5517
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
bsd-3-clause
yungyuc/solvcon
sandbox/gas/tube/sodtube1d/handler_data.py
1
6683
# # handler_data.py # # Description: # helper functions to handle, caculate the solutions. # import sys import scipy.optimize as so import matplotlib.pyplot as plt class DataManager(): """ Manage how to get extended information by input data. """ def __init__(self): pass def get_errorNo...
bsd-3-clause
cl4rke/scikit-learn
sklearn/cluster/tests/test_bicluster.py
226
9457
"""Testing for Spectral Biclustering methods""" import numpy as np from scipy.sparse import csr_matrix, issparse from sklearn.grid_search import ParameterGrid from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from...
bsd-3-clause
jzt5132/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
kazemakase/scikit-learn
examples/covariance/plot_covariance_estimation.py
250
5070
""" ======================================================================= Shrinkage covariance estimation: LedoitWolf vs OAS and max-likelihood ======================================================================= When working with covariance estimation, the usual approach is to use a maximum likelihood estimator,...
bsd-3-clause
trungnt13/scikit-learn
sklearn/covariance/__init__.py
389
1157
""" The :mod:`sklearn.covariance` module includes methods and algorithms to robustly estimate the covariance of features given a set of points. The precision matrix defined as the inverse of the covariance is also estimated. Covariance estimation is closely related to the theory of Gaussian Graphical Models. """ from ...
bsd-3-clause
antoinecarme/pyaf
tests/bugs/issue_36/display_version_info.py
1
1141
def getVersions(): import os, platform, pyaf lVersionDict = {}; lVersionDict["PyAF_version"] = pyaf.__version__; lVersionDict["system_platform"] = platform.platform(); lVersionDict["system_uname"] = platform.uname(); lVersionDict["system_processor"] = platform.processor(); lVersion...
bsd-3-clause
h2educ/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
HBPNeurorobotics/nest-simulator
examples/nest/Potjans_2014/spike_analysis.py
4
6267
# -*- coding: utf-8 -*- # # spike_analysis.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,...
gpl-2.0
StevenReitsma/kaggle-galaxyzoo
graphs/per_class.py
1
3765
import matplotlib matplotlib.use('Agg') import prettyplotlib as ppl import matplotlib.pyplot as plt import numpy as np data1 = np.genfromtxt('error_inv.csv', dtype=float, delimiter=',') data2 = np.genfromtxt('error_var.csv', dtype=float, delimiter=',') for i in range(0, data1.shape[0]): if np.sum(data1[i, 0:2]) != ...
gpl-2.0
CyclotronResearchCentre/forward
examples/example_sphere_summary.py
1
2382
import numpy as np from matplotlib.pyplot import plot, show, legend, close import matplotlib.pyplot as plt close("all") import seaborn as sns #sns.set(style="whitegrid") sns.set(style="ticks") # Allow text to be edited in Illustrator import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 res = np.load("SphereResu...
gpl-2.0
arcolife/scholarec
corpus/data_modelling/training_skel.py
1
2615
import pandas as pd # steps to form a skeleton for sample training data of ratings ''' # here fields used are: Physics, Probability & Mathematics (in order) # total entries ~43 (around 15 for each) id = ['1401.0828v1', '1010.5976v1', '0706.0750v2', '1103.4289v1', '0611347v1', '1304.3144...
gpl-3.0
jm-begon/scikit-learn
sklearn/cross_decomposition/tests/test_pls.py
215
11427
import numpy as np from sklearn.utils.testing import (assert_array_almost_equal, assert_array_equal, assert_true, assert_raise_message) from sklearn.datasets import load_linnerud from sklearn.cross_decomposition import pls_ from nose.tools import assert_equal def test_pls(): d =...
bsd-3-clause
sandeepgupta2k4/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_test.py
14
46097
# 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
ninotoshi/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator.py
1
24626
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
apache-2.0
Britefury/scikit-image
doc/examples/plot_gabor.py
11
4450
""" ============================================= Gabor filter banks for texture classification ============================================= In this example, we will see how to classify textures based on Gabor filter banks. Frequency and orientation representations of the Gabor filter are similar to those of the huma...
bsd-3-clause
hpcbg/metaheuristic
gradient.py
1
1125
# -*- coding: utf-8 -*- """ Hill Climbing aka Gradient Descent is local search method. @author: Simeon Tsvetanov """ import random import matplotlib.pyplot as plt solutions = [3, 5, 6, 7, 8, 6, 4, 3, 2, 5, 6, 7, 9, 23, 35, 12, 6, 5, 4, 10, 15, 13, 8, 9, 12, 15, 4] x_axis_len = len(solutions) plt.axis([0, x_axis_len, ...
gpl-2.0
simonsfoundation/CaImAn
use_cases/custom/rois_Hendrik.py
2
50709
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Thu Oct 22 13:22:26 2015 @author: agiovann """ from builtins import map from builtins import zip from builtins import str from builtins import range import cv2 import json import logging import matplotlib.pyplot as pl import matplotlib.patches as mpatches...
gpl-2.0
gengliangwang/spark
python/pyspark/pandas/internal.py
1
57972
# # 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
pombredanne/dask
dask/dataframe/utils.py
1
4423
from __future__ import absolute_import, division, print_function from collections import Iterator import numpy as np import pandas as pd import toolz def shard_df_on_index(df, divisions): """ Shard a DataFrame by ranges on its index Examples -------- >>> df = pd.DataFrame({'a': [0, 10, 20, 30, 40]...
bsd-3-clause
fyffyt/scikit-learn
sklearn/metrics/tests/test_ranking.py
127
40813
from __future__ import division, print_function import numpy as np from itertools import product import warnings from scipy.sparse import csr_matrix from sklearn import datasets from sklearn import svm from sklearn import ensemble from sklearn.datasets import make_multilabel_classification from sklearn.random_projec...
bsd-3-clause
jmetzen/scikit-learn
sklearn/gaussian_process/tests/test_kernels.py
23
11813
"""Testing for kernels for Gaussian processes.""" # Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Licence: BSD 3 clause from collections import Hashable from sklearn.externals.funcsigs import signature import numpy as np from scipy.optimize import approx_fprime from sklearn.metrics.pairwise \ imp...
bsd-3-clause
waynenilsen/statsmodels
statsmodels/examples/ex_feasible_gls_het.py
34
4267
# -*- coding: utf-8 -*- """Examples for linear model with heteroscedasticity estimated by feasible GLS These are examples to check the results during developement. The assumptions: We have a linear model y = X*beta where the variance of an observation depends on some explanatory variable Z (`exog_var`). linear_model...
bsd-3-clause
jniediek/mne-python
tutorials/plot_modifying_data_inplace.py
4
2936
""" .. _tut_modifying_data_inplace: Modifying data in-place ======================= """ from __future__ import print_function import mne import os.path as op import numpy as np from matplotlib import pyplot as plt ############################################################################### # It is often necessar...
bsd-3-clause
alexei-matveev/ase-local
ase/calculators/eam.py
1
28788
"""Calculator for the Embedded Atom Method Potential""" # eam.py # Embedded Atom Method Potential # These routines integrate with the ASE simulation environment # Paul White (Oct 2012) # UNCLASSIFIED # License: See accompanying license files for details import os import numpy as np from ase.test import NotAvailable...
gpl-2.0
dcprojects/CoolProp
dev/scripts/fit_ancillary_ODRPACK.py
5
11720
from __future__ import division import numpy as np from scipy.odr import * import scipy.optimize, random import matplotlib.pyplot as plt import textwrap import random from CoolProp.CoolProp import Props, get_REFPROPname def rsquared(x, y): """ Return R^2 where x and y are array-like. from http://stac...
mit
srowen/spark
python/pyspark/pandas/data_type_ops/null_ops.py
5
1936
# # 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
shllybkwrm/swarm_gesture_control
recognition/dataProcessing.py
1
47533
# -*- coding: utf-8 -*- """ Created on Thu Feb 12 18:29:30 2015 @author: Shelly """ #import cv2 ### NOTE: Needs OpenCV 2.4(.10) if CV2-KNN used import math import numpy as np from sklearn import cross_validation from sklearn.svm import SVC from sklearn.learning_curve import learning_curve from sklearn.metrics import c...
gpl-2.0
ajdagokcen/madlyambiguous-repo
python/embcat_server.py
1
12141
import argparse import rpyc from rpyc.utils.server import ThreadedServer import csv import gensim from gensim.models import Word2Vec import numpy as np from numpy import linalg from sklearn.cluster import SpectralClustering from nltk.tokenize import TreebankWordTokenizer from nltk.corpus import stopwords from nltk.prob...
gpl-3.0
Lawrence-Liu/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
143
22295
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
danieldmm/minerva
scripts/explore_statistics.py
1
1441
import pandas as pd import os import numpy as np import matplotlib.pyplot as plt # %matplotlib inline plt.rcParams["figure.figsize"] = (8, 5) AZ_ZONES = ['AIM', 'BAS', 'BKG', 'CTR', 'OTH', 'OWN', 'TXT'] CORESC_LIST = ["Hyp", "Mot", "Bac", "Goa", "Obj", "Met", "Exp", "Mod", "Obs", "Res", "Con"] CORESC_LIST = [x.lower(...
gpl-3.0
numenta/nupic.research
nupic/research/support/elastic_logger.py
3
9319
# Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2019, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it unde...
agpl-3.0
pytorch/fairseq
examples/speech_to_text/prep_mtedx_data.py
1
8995
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
mit
TheHonestGene/risk-predictor
setup.py
1
1882
from setuptools import setup, find_packages # Always prefer setuptools over distutils from codecs import open # To use a consistent encoding from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'README.rst'), encoding='utf-8') as...
mit
smartscheduling/scikit-learn-categorical-tree
examples/applications/wikipedia_principal_eigenvector.py
233
7819
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
oew1v07/scikit-image
doc/examples/plot_seam_carving.py
13
2351
""" ============ Seam Carving ============ This example demonstrates how images can be resized using seam carving [1]_. Resizing to a new aspect ratio distorts image contents. Seam carving attempts to resize *without* distortion, by removing regions of an image which are less important. In this example we are using th...
bsd-3-clause
rl-institut/smenos
reegis_hp/berlin_hp/berlin_brdbg_example_plot.py
7
3580
#!/usr/bin/python3 # -*- coding: utf-8 import logging import matplotlib.pyplot as plt from oemof.outputlib import to_pandas as tpd from oemof.tools import logger from oemof.core import energy_system as es # The following dictionaries are a workaround due to issue #26 rename = { "(val, ('sink', 'Landkreis Witten...
gpl-3.0
gibiansky/tensorflow
tensorflow/contrib/learn/__init__.py
11
1763
# 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
LiaoPan/scikit-learn
sklearn/linear_model/setup.py
169
1567
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
twankim/weaksemi
utils.py
1
7546
# -*- coding: utf-8 -*- # @Author: twankim # @Date: 2017-05-05 20:22:13 # @Last Modified by: twankim # @Last Modified time: 2017-10-26 03:25:34 import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pandas as pd def accuracy(y_true,y_pred): return 100*np.sum(y_true==...
mit
haanme/DWIProstateMotionCorrection
motioncorrection_transformix.py
1
11807
#!/usr/bin/env python elastix_dir = '/Users/eija/Documents/SW/Elastix/elastix_sources_v4.7/bin/bin/' experiment_dir = '/Users/eija/Desktop/prostate_MR/pipelinedata' mask_matfile_basedir_hB = '/Users/eija/Desktop/prostate_MR/PET_MR_dwis/Carimas27projectfiles_Hb_work_all_noGS_for_Motion_Cor/ROI_mat_files' mask_matfile_b...
mit
louispotok/pandas
pandas/tests/series/test_timeseries.py
3
35025
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import pytest import numpy as np from datetime import datetime, timedelta, time import pandas as pd import pandas.util.testing as tm import pandas.util._test_decorators as td from pandas._libs.tslib import iNaT from pandas.compat import lrange, StringIO, product from ...
bsd-3-clause
pythonvietnam/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
mrshu/scikit-learn
examples/cluster/plot_mini_batch_kmeans.py
2
4072
""" ===================================================== A demo of the K Means clustering algorithm ===================================================== We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is faster, but gives slightly different results (see :ref:`mini_batch_kmea...
bsd-3-clause
OpenPHDGuiding/phd2
contributions/MPI_IS_gaussian_process/tools/plot_dec_data.py
1
1316
#!/usr/bin/env python import matplotlib.pyplot as plt from numpy import genfromtxt def read_data(): measurement_data = genfromtxt('tm_data.csv', delimiter=',') # read GP data from csv measurement_data = measurement_data[1:,:] # strip first line to remove header text location = measurement_data...
bsd-3-clause
gustavovaliati/ci724-ppginfufpr-2016
exerc-3c/main.py
1
1897
import numpy as np import argparse, cv2, glob, sys import datetime ap = argparse.ArgumentParser() ap.add_argument("-t", "--target", required = True, help = "Is the file used as reference for the comparison") ap.add_argument("-d", "--dataset", required = True, help = "Path to the directory of images") args = vars(ap.pa...
gpl-3.0
UltronAI/Deep-Learning
Pattern-Recognition/hw3-Unsupervised-Learning/main.py
1
1579
import numpy as np import utils import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.cluster import KMeans as kmeans for n in range(2, 5): x = np.loadtxt("dataset.txt") N, d = x.shape x_train, var, selected = PCA(x, n) var_selected = np.zeros(d) var_...
mit
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/core/groupby.py
3
146721
import types from functools import wraps import numpy as np import datetime import collections import warnings import copy from textwrap import dedent from pandas.compat import ( zip, range, lzip, callable, map ) from pandas import compat from pandas.compat.numpy import function as nv, _np_version_under1p8 fr...
mit
hubert667/AIR
src/scripts/fakeQueryData.py
1
2040
from sklearn import svm import sys, random, ast, os try: import include, copy, pickle except: pass import retrieval_system, environment, evaluation,comparison,ranker import query as queryClass import ranker as rankerClass from clusterData import * import numpy as np from queryRankers import * from queryFeatures...
gpl-3.0
cmick/sklearn-rri
sklearn_rri/rri.py
1
6938
"""Reflective Random Indexing (RRI) algorithm implementation.""" import math import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing import normalize from sklearn.random_projection import sparse_random_matrix from sklearn.utils.extmath import safe_sparse_dot from sklearn.u...
bsd-3-clause
pratapvardhan/pandas
pandas/tests/test_lib.py
7
7887
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import Index from pandas._libs import lib, writers as libwriters import pandas.util.testing as tm class TestMisc(object): def test_max_len_string_array(self): arr = a = np.array(['foo', 'b', np.nan], dtype='object') assert li...
bsd-3-clause
xiaoxiamii/scikit-learn
sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
bsd-3-clause
sertansenturk/tomato
src/tomato/symbolic/symbtr/extras/txt.py
1
11400
import os import warnings import pandas as pd from ....io import IO from ..dataextractor import DataExtractor from ..reader.mu2 import Mu2Reader class Txt: symbtr_cols = ['Sira', 'Kod', 'Nota53', 'NotaAE', 'Koma53', 'KomaAE', 'Pay', 'Payda', 'Ms', 'LNS', 'Bas', 'Soz1', 'Offset'] @classm...
agpl-3.0
lawlietfans/tushare
tushare/stock/reference.py
27
25190
# -*- coding:utf-8 -*- """ 投资参考数据接口 Created on 2015/03/21 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ from __future__ import division from tushare.stock import cons as ct from tushare.stock import ref_vars as rv from tushare.util import dateu as dt import pandas as pd import time i...
bsd-3-clause
feranick/GES_AT
Other/Cursors/cursors.py
1
1136
import sys from PyQt5 import QtWidgets from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas import matplotlib.pyplot as plt from matplotlib.widgets import Cursor class Window(QtWidgets.QDialog): def __init__(self, parent=None): super(Window, self).__init__(parent) self.f...
gpl-3.0
jblackburne/scikit-learn
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
mne-tools/mne-tools.github.io
0.21/_downloads/704841087184bb64030fba1c58ce8038/plot_topo_compare_conditions.py
20
1828
""" ================================================= Compare evoked responses for different conditions ================================================= In this example, an Epochs object for visual and auditory responses is created. Both conditions are then accessed by their respective names to create a sensor layout...
bsd-3-clause
webmasterraj/GaSiProMo
flask/lib/python2.7/site-packages/pandas/stats/fama_macbeth.py
16
6740
from pandas.core.base import StringMixin from pandas.compat import StringIO, range import numpy as np from pandas.core.api import Series, DataFrame import pandas.stats.common as common from pandas.util.decorators import cache_readonly def fama_macbeth(**kwargs): """Runs Fama-MacBeth regression. Parameters ...
gpl-2.0
mailhexu/pyDFTutils
examples/abinit_phonon_unfolding/unfold_example.py
1
4006
#!/usr/bin/env python import abipy.abilab as abilab import numpy as np from ase.build import bulk from ase.dft.kpoints import get_special_points, bandpath from pyDFTutils.unfolding.phonon_unfolder import phonon_unfolder from pyDFTutils.phonon.plotphon import plot_band_weight import matplotlib.pyplot as plt atomic_mass...
lgpl-3.0
mojoboss/scikit-learn
examples/cluster/plot_dict_face_patches.py
337
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...
bsd-3-clause
dsm054/pandas
scripts/find_undoc_args.py
2
5101
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Script that compares the signature arguments with the ones in the docsting and returns the differences in plain text or GitHub task list format. Usage:: $ ./find_undoc_args.py (see arguments below) """ from __future__ import print_function import sys from collecti...
bsd-3-clause
tmhm/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
276
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
lbishal/scikit-learn
sklearn/utils/tests/test_linear_assignment.py
421
1349
# Author: Brian M. Clapper, G Varoquaux # License: BSD import numpy as np # XXX we should be testing the public API here from sklearn.utils.linear_assignment_ import _hungarian def test_hungarian(): matrices = [ # Square ([[400, 150, 400], [400, 450, 600], [300, 225, 300]], ...
bsd-3-clause
vybstat/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