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
wqferr/AniMathors
core/anim.py
1
2063
from math import ceil import matplotlib.pyplot as plt import matplotlib.animation as anim class Animation(object): def __init__(self, *args, **kwargs): self._fig, self._ax = plt.subplots() self._fig.set_facecolor(kwargs.get('facecolor', 'black')) self._ax.set_xlim(*kwargs.get('xlim', (-1,...
mit
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/numpy/lib/function_base.py
19
164441
from __future__ import division, absolute_import, print_function import collections import operator import re import sys import warnings import numpy as np import numpy.core.numeric as _nx from numpy.core import linspace, atleast_1d, atleast_2d, transpose from numpy.core.numeric import ( ones, zeros, arange, conc...
mit
codein/poc
sql_loader/sql_loader.py
1
7982
import os import logging import sqlite3 import pandas as pd SQL_LOADER_HOME = '~/temp/sql_loader_home' DB_NAME = 'sql_loader_1.db' db_path = os.path.expanduser('{0}/{1}'.format(SQL_LOADER_HOME, DB_NAME)) select_command_template = """ select count(*) from {table_name} """ select_by_primary_key_command_template = """ ...
mit
julienr/vispy
vispy/visuals/axis.py
13
18105
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2014, Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # -------------------------------------------------------------------------...
bsd-3-clause
DTMilodowski/SPA_tools
field_data/collate_leaf_traits_and_environmental_data.py
1
38181
import numpy as np from matplotlib import pyplot as plt from scipy import stats import sys sys.path.append('/home/dmilodow/DataStore_DTM/BALI/MetDataProcessing/UtilityTools/') #import statistics_tools as stats2 import load_field_data as field sys.path.append('/home/dmilodow/DataStore_DTM/BALI/LiDAR/src/') import LiDAR...
gpl-3.0
S2H-Mobile/RoboND-Perception-Project
scripts/features.py
1
2031
import matplotlib.colors import matplotlib.pyplot as plt import numpy as np from pcl_helper import * def rgb_to_hsv(rgb_list): rgb_normalized = [1.0*rgb_list[0]/255, 1.0*rgb_list[1]/255, 1.0*rgb_list[2]/255] hsv_normalized = matplotlib.colors.rgb_to_hsv([[rgb_normalized]])[0][0] return hsv_normalized de...
mit
toobaz/pandas
pandas/tests/dtypes/cast/test_find_common_type.py
3
3956
import numpy as np import pytest from pandas.core.dtypes.cast import find_common_type from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype, PeriodDtype @pytest.mark.parametrize( "source_dtypes,expected_common_dtype", [ ((np.int64,), np.int64), ((np.uint64,), np.uint64), ...
bsd-3-clause
vasilvv/SSIM
tools/visualize.py
2
1033
#!/usr/bin/python import matplotlib.pyplot as plt import sys if len(sys.argv) < 2: print "Usage: vizualize.py file1[:label1] file2[:label2] ..." colors = ['g', 'b', 'r', '#F800F0', '#00E8CC', '#E8E800'] markers = { 'I' : '*', 'P' : 's', 'B' : 'o' } if len(sys.argv) - 1 > len(colors): print "Too many files s...
mit
justincassidy/scikit-learn
examples/cluster/plot_mini_batch_kmeans.py
265
4081
""" ==================================================================== Comparison of the K-Means and MiniBatchKMeans clustering algorithms ==================================================================== We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is faster, but give...
bsd-3-clause
kaichogami/scikit-learn
sklearn/decomposition/__init__.py
76
1490
""" The :mod:`sklearn.decomposition` module includes matrix decomposition algorithms, including among others PCA, NMF or ICA. Most of the algorithms of this module can be regarded as dimensionality reduction techniques. """ from .nmf import NMF, ProjectedGradientNMF, non_negative_factorization from .pca import PCA, Ra...
bsd-3-clause
sunzhxjs/JobGIS
lib/python2.7/site-packages/pandas/tseries/tests/test_period.py
9
153010
"""Tests suite for Period handling. Parts derived from scikits.timeseries code, original authors: - Pierre Gerard-Marchant & Matt Knox - pierregm_at_uga_dot_edu - mattknow_ca_at_hotmail_dot_com """ from datetime import datetime, date, timedelta from numpy.ma.testutils import assert_equal from pandas import Timesta...
mit
zihua/scikit-learn
sklearn/base.py
5
19817
"""Base classes for all estimators.""" # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import copy import warnings import numpy as np from scipy import sparse from .externals import six from .utils.fixes import signature from .utils.deprecation import deprecated from .exceptions impo...
bsd-3-clause
cybernet14/scikit-learn
examples/cluster/plot_dbscan.py
346
2479
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ print(__doc__) import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics from sklearn...
bsd-3-clause
guziy/basemap
examples/plotmap_oo.py
2
2718
from __future__ import (absolute_import, division, print_function) # make plot of etopo bathymetry/topography data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. # the data is interpolated to the native projection grid. ######################...
gpl-2.0
mrocklin/blaze
blaze/server/tests/test_server.py
1
8213
from __future__ import absolute_import, division, print_function import pytest pytest.importorskip('flask') import datashape import numpy as np from flask import json from datetime import datetime from pandas import DataFrame from toolz import pipe from odo import odo from blaze.utils import example from blaze impor...
bsd-3-clause
zimenglan-sysu-512/pose_action_caffe
lib/fast_rcnn/test.py
43
11975
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Test a Fast R-CNN network on an imdb (image database).""" from fast...
mit
zuphilip/ocropy
OLD/lineproc.py
15
6891
################################################################ ### functions specific to text line processing ### (text line segmentation is in lineseg) ################################################################ from scipy import stats from scipy.ndimage import interpolation,morphology,filters from pylab impor...
apache-2.0
LiaoPan/scikit-learn
examples/linear_model/plot_sgd_loss_functions.py
249
1095
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
bsd-3-clause
poryfly/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/sklearn/ensemble/gradient_boosting.py
8
73285
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
mit
krischer/python-future
src/future/utils/__init__.py
10
20353
""" A selection of cross-compatible functions for Python 2 and 3. This exports useful functions for 2/3 compatible code that are not builtins on Python 3: * bind_method: binds functions to classes * ``native_str_to_bytes`` and ``bytes_to_native_str`` * ``native_str``: always equal to the native platform s...
mit
mmoiozo/IROS
sw/tools/tcp_aircraft_server/phoenix/__init__.py
86
4470
#Copyright 2014, Antoine Drouin """ Phoenix is a Python library for interacting with Paparazzi """ import math """ Unit convertions """ def rad_of_deg(d): return d/180.*math.pi def deg_of_rad(r): return r*180./math.pi def rps_of_rpm(r): return r*2.*math.pi/60. def rpm_of_rps(r): return r/2./math.pi*60. def m_of_i...
gpl-2.0
dchabot/bluesky
bluesky/testing/decorators.py
4
4434
######################################################################## # Copyright (c) 2015, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistribution and use in ...
bsd-3-clause
roxyboy/scikit-learn
sklearn/datasets/tests/test_20news.py
280
3045
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause
jakobworldpeace/scikit-learn
examples/calibration/plot_calibration_curve.py
113
5904
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
njoubert/MAVProxy
MAVProxy/modules/lib/wxhorizon_ui.py
1
32207
import time from wxhorizon_util import Attitude, VFR_HUD, Global_Position_INT, BatteryInfo, FlightState, WaypointInfo, FPS from wx_loader import wx import math, time import matplotlib matplotlib.use('wxAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.figure import F...
gpl-3.0
DhrubajyotiDas/PyAbel
examples/example_onion_bordas.py
1
1062
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import abel import matplotlib.pyplot as plt # Dribinski sample image IM = abel.tools.analytical.sample_image(n=501) # split into quadrants origQ = abel.tools.symme...
mit
kapteyn-astro/kapteyn
doc/source/EXAMPLES/mu_reproj_interact.py
1
1085
from kapteyn import maputils from matplotlib import pyplot as plt import numpy # Read first image as base Basefits = maputils.FITSimage(promptfie=maputils.prompt_fitsfile) print(type(Basefits), isinstance(Basefits, maputils.FITSimage)) # Get data from a second image. This is the data that # should be reprojected to...
bsd-3-clause
clemkoa/scikit-learn
benchmarks/bench_rcv1_logreg_convergence.py
58
7229
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import matplotlib.pyplot as plt import numpy as np import gc import time from sklearn.externals.joblib import Memory from sklearn.linear_model import (LogisticRegression, SGDClassifi...
bsd-3-clause
rajat1994/scikit-learn
sklearn/datasets/mldata.py
309
7838
"""Automatically download MLdata datasets.""" # Copyright (c) 2011 Pietro Berkes # License: BSD 3 clause import os from os.path import join, exists import re import numbers try: # Python 2 from urllib2 import HTTPError from urllib2 import quote from urllib2 import urlopen except ImportError: # Pyt...
bsd-3-clause
Achuth17/scikit-learn
sklearn/decomposition/pca.py
6
23035
""" Principal Component Analysis """ # 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> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
ContinuumIO/pydata-strata-2014-sj
07-final-app/baseball_salaries.py
1
2487
import flask import pandas as pd import numpy as np import blaze as bz from into import into from bokeh.embed import components from bokeh.resources import INLINE from bokeh.templates import RESOURCES from bokeh.utils import encode_utf8 from bokeh.models import ColumnDataSource import bokeh.plotting as plt app = f...
bsd-2-clause
brclark-usgs/flopy
autotest/t007_test.py
1
26204
# Test export module import sys sys.path.insert(0, '..') import copy import os import shutil import numpy as np import flopy pth = os.path.join('..', 'examples', 'data', 'mf2005_test') namfiles = [namfile for namfile in os.listdir(pth) if namfile.endswith('.nam')] # skip = ["MNW2-Fig28.nam", "testsfr2.nam", "testsfr2...
bsd-3-clause
nikitasingh981/scikit-learn
examples/decomposition/plot_kernel_pca.py
353
2011
""" ========== Kernel PCA ========== This example shows that Kernel PCA is able to find a projection of the data that makes data linearly separable. """ print(__doc__) # Authors: Mathieu Blondel # Andreas Mueller # License: BSD 3 clause import numpy as np import matplotlib.pyplot as plt from sklearn.decomp...
bsd-3-clause
dhlab-epfl/cadasters
geojson_processing/evaluation.py
1
9550
#!/usr/bin/env python __author__ = "solivr" __license__ = "GPL" from typing import Union import pandas as pd import geopandas as gpd from sklearn.neighbors import NearestNeighbors import numpy as np from tqdm import tqdm def iou_get_precision(dataframe_correspondencies: Union[pd.DataFrame, gpd.GeoDataFrame], ...
gpl-3.0
JosmanPS/scikit-learn
sklearn/neighbors/tests/test_approximate.py
142
18692
""" Testing for the approximate neighbor search using Locality Sensitive Hashing Forest module (sklearn.neighbors.LSHForest). """ # Author: Maheshakya Wijewardena, Joel Nothman import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
rabrahm/ceres
vbt/vbtpipe.py
1
42920
import sys import matplotlib matplotlib.use("Agg") from pylab import * ioff() base = '../' sys.path.append(base+"utils/Continuum/") sys.path.append(base+"utils/Correlation/") sys.path.append(base+"utils/GLOBALutils/") sys.path.append(base+"utils/OptExtract/") baryc_dir= base+'utils/SSEphem/' sys.path.append(baryc_di...
mit
Shen-Lab/cNMA
Software/helperScripts/makeBoxPlot.py
1
5784
''' Created on Sep 26, 2014 @author: oliwa ''' import argparse import sys import os import numpy as np from prody import * import glob import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt def percentageDecrease(x, y): """Return the percentage decrease from x towards y Args: ...
mit
alan-unravel/bokeh
bokeh/compat/mplexporter/exporter.py
32
12403
""" Matplotlib Exporter =================== This submodule contains tools for crawling a matplotlib figure and exporting relevant pieces to a renderer. """ import warnings import io from . import utils import matplotlib from matplotlib import transforms from matplotlib.backends.backend_agg import FigureCanvasAgg clas...
bsd-3-clause
moserand/crosswater
crosswater/routing_model/aqu_sys_hydro.py
1
23407
""" Aquasim variable definition (only hydraulics without substances). @author: moserand """ import fnmatch import math import numpy as np from collections import defaultdict import sys import itertools import tables import pandas from crosswater.read_config import read_config from crosswater.preprocess...
gpl-3.0
abhishekkrthakur/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
macks22/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
datitran/Krimskrams
Kaggle/Sberbank Russian Housing Market/nn_model_macro.py
1
5012
import numpy as np np.random.seed(42) import tensorflow as tf tf.set_random_seed(42) import argparse import pandas as pd from sklearn import preprocessing from keras.models import Model from keras.layers import Dense, Input, Dropout, average from keras.optimizers import Adam from keras.callbacks import EarlyStopping...
mit
hrjn/scikit-learn
examples/svm/plot_custom_kernel.py
93
1562
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
dcprojects/CoolProp
dev/TTSE/check_TTSE_old.py
3
3304
from CoolProp.Plots import Ph import CoolProp import CoolProp.CoolProp as CP import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx import matplotlib.ticker import numpy as np import random fig = plt.figure(figsize=(10,5)) ax1 = fig.add_axes((0.08,0.1,0.32,0.83)) ax2 = fig.add_a...
mit
ahnitz/mpld3
mpld3/test_plots/test_text.py
21
1305
"""Plot to test text""" import matplotlib.pyplot as plt import mpld3 def create_plot(): fig, ax = plt.subplots() ax.grid(color='gray') # test font sizes x = 0.1 for y, size in zip([0.1, 0.3, 0.5, 0.7, 0.9], [8, 12, 16, 20, 24]): ax.text(x, y, "size={0}".format(size)...
bsd-3-clause
AvinashSingh786/RegSmart
Reports.py
1
23898
import os import time import datetime import reportlab.lib.enums as e from reportlab.lib import colors from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.lib.pagesizes import letter from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.u...
mit
harisbal/pandas
pandas/tests/indexes/datetimes/test_construction.py
1
29387
from datetime import timedelta from functools import partial from operator import attrgetter import numpy as np import pytest import pytz from pandas._libs.tslib import OutOfBoundsDatetime from pandas._libs.tslibs import conversion import pandas as pd from pandas import ( DatetimeIndex, Index, Timestamp, date_ra...
bsd-3-clause
saketkc/statsmodels
statsmodels/examples/ex_multivar_kde.py
34
1504
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import axes3d import statsmodels.api as sm """ This example illustrates the nonparametric estimation of a bivariate bi-modal distribution that is a mixture of two normal distri...
bsd-3-clause
lin-credible/scikit-learn
examples/linear_model/plot_ols.py
220
1940
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Linear Regression Example ========================================================= This example uses the only the first feature of the `diabetes` dataset, in order to illustrate a two-dimensional plot of this regre...
bsd-3-clause
gfyoung/pandas
pandas/core/strings/__init__.py
2
1187
""" Implementation of pandas.Series.str and its interface. * strings.accessor.StringMethods : Accessor for Series.str * strings.base.BaseStringArrayMethods: Mixin ABC for EAs to implement str methods Most methods on the StringMethods accessor follow the pattern: 1. extract the array from the series (or index) ...
bsd-3-clause
mojoboss/scikit-learn
sklearn/metrics/tests/test_score_objects.py
84
14181
import pickle import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
deepesch/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
michalsenkyr/spark
python/pyspark/ml/clustering.py
5
50284
# # 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
saketkc/statsmodels
statsmodels/tsa/filters/cf_filter.py
28
3435
from statsmodels.compat.python import range import numpy as np from ._utils import _maybe_get_pandas_wrapper # the data is sampled quarterly, so cut-off frequency of 18 # Wn is normalized cut-off freq #Cutoff frequency is that frequency where the magnitude response of the filter # is sqrt(1/2.). For butter, the norm...
bsd-3-clause
chris1610/pbpython
code/advanced_excel.py
1
2204
""" See http://pbpython.com/advanced-excel-workbooks.html for details on this script """ from __future__ import print_function import pandas as pd from xlsxwriter.utility import xl_rowcol_to_cell def format_excel(writer, df_size): """ Add Excel specific formatting to the workbook df_size is a tuple represent...
bsd-3-clause
alexis-roche/nipy
tools/run_log_examples.py
4
6007
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function, with_statement DESCRIP = 'Run and log examples' EPILOG = \ """ Run examples in directory Typical usage is: run_log_examples.py nipy/examples -...
bsd-3-clause
HasanIssa88/EMG_Classification
EMG_Thershold.py
1
5278
''' This function will read the EMG data after the RMS filter and will make thresholding for the force and the EMG Channels by deleting all values which are below a certain Thershold and will keep the values which is above and plot all channels configuration for this and will construct a DataFrame from all channel...
gpl-3.0
manojgudi/sandhi
modules/gr36/gnuradio-core/src/examples/pfb/fmtest.py
17
7785
#!/usr/bin/env python # # Copyright 2009 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
mlperf/training_results_v0.6
Intel/benchmarks/minigo/implementations/tensorflow/oneoffs/l2_cost_by_var.py
7
3864
# Copyright 2018 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
altermarkive/Resurrecting-JimFleming-Numerai
src/ml-zygmuntz--numer.ai/march/validate_lr.py
1
2996
#!/usr/bin/env python3 "Load data, create the validation split, optionally scale data, train a linear model, evaluate" "Code updated for march 2016 data" import json import pandas as pd from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.preprocessing import Norma...
mit
jkarnows/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
amueller/scipy-2016-sklearn
notebooks/figures/plot_pca.py
5
3131
from sklearn.decomposition import PCA import matplotlib.pyplot as plt import numpy as np def plot_pca_illustration(): rnd = np.random.RandomState(5) X_ = rnd.normal(size=(300, 2)) X_blob = np.dot(X_, rnd.normal(size=(2, 2))) + rnd.normal(size=2) pca = PCA() pca.fit(X_blob) X_pca = pca.transfo...
cc0-1.0
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/tests/io/json/test_pandas.py
11
44634
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101 import pytest from pandas.compat import (range, lrange, StringIO, OrderedDict, is_platform_32bit) import os import numpy as np from pandas import (Series, DataFrame, DatetimeIndex, Timestamp, read_json, compat) fro...
mit
ahoyosid/scikit-learn
sklearn/decomposition/pca.py
24
22932
""" Principal Component Analysis """ # 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> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
akunze3/pytrajectory
examples/ex3_Aircraft.py
1
3087
# vertical take-off aircraft # import trajectory class and necessary dependencies from pytrajectory import ControlSystem from sympy import sin, cos import numpy as np from numpy import pi # define the function that returns the vectorfield def f(x,u): x1, x2, x3, x4, x5, x6 = x # system state variables u1, u2...
bsd-3-clause
PatrickChrist/scikit-learn
sklearn/pipeline.py
162
21103
""" The :mod:`sklearn.pipeline` module implements utilities to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Lars Buitinck # Licence: BSD from collections import defaultdict...
bsd-3-clause
sowe9385/qiime
scripts/make_otu_heatmap.py
15
11322
#!/usr/bin/env python from __future__ import division __author__ = "Dan Knights" __copyright__ = "Copyright 2011, The QIIME project" __credits__ = [ "Dan Knights", "Jose Carlos Clemente Litran", "Yoshiki Vazquez Baeza", "Greg Caporaso", "Jai Ram Rideout"] __license__ = "GPL" __version__ = "1.9.1-de...
gpl-2.0
archiekey/MachineLearningResearch
Clustering.py
2
1119
from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_selection import SelectPercentile, f_classif from sklearn.metrics import accuracy_score from sklearn.cluster import KMeans from preprocesstest import testdata from preprocesstra...
apache-2.0
suiyuan2009/tensorflow
tensorflow/examples/learn/iris_custom_model.py
37
3651
# 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
jwlockhart/concept-networks
nlp.py
1
2220
# utility functions for NLP-based similarity metrics # version 1.0 # code modified from: # https://stackoverflow.com/questions/8897593/similarity-between-two-text-documents import nltk import string import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer stemmer = nltk.stem.porter.PorterStem...
gpl-3.0
manashmndl/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
yarikoptic/pystatsmodels
statsmodels/examples/tut_ols_ancova.py
4
2413
'''Examples OLS Note: uncomment plt.show() to display graphs Summary: ======== Relevant part of construction of design matrix xg includes group numbers/labels, x1 is continuous explanatory variable >>> dummy = (xg[:,None] == np.unique(xg)).astype(float) >>> X = np.c_[x1, dummy[:,1:], np.ones(nsample)] Estimate the...
bsd-3-clause
caseyclements/bokeh
examples/plotting/file/unemployment.py
46
1846
from collections import OrderedDict import numpy as np from bokeh.plotting import ColumnDataSource, figure, show, output_file from bokeh.models import HoverTool from bokeh.sampledata.unemployment1948 import data # Read in the data with pandas. Convert the year column to string data['Year'] = [str(x) for x in data['Y...
bsd-3-clause
crichardson17/starburst_atlas
Low_resolution_sims/Dusty_LowRes/Geneva_cont_NoRot/Geneva_cont_NoRot_2/fullgrid/Optical1.py
30
9342
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
TheaGao/SklearnModel
Vote_Results.py
1
1602
import os import numpy as np from baseZhang import class_encoder_to_number from sklearn.ensemble import VotingClassifier from sklearn.externals import joblib from preprocessData import getDataXY trainX, trainY, testX, testY, validX, validY = getDataXY() encoder_path = 'encoder.pkl' if not os.path.isfile(encoder_pat...
mit
aruneral01/autokit
autokit/hyper.py
2
7674
import numpy as np import scipy as sp from sklearn.linear_model import Ridge, RidgeClassifier, LogisticRegression from sklearn.naive_bayes import BernoulliNB from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, BaggingClassifier, BaggingRegressor, RandomForestClassifier from sklearn.pipel...
mit
tcstewar/nstbot
nstbot/retinabot.py
1
13309
from . import nstbot import numpy as np import threading class RetinaBot(nstbot.NSTBot): def initialize(self): super(RetinaBot, self).initialize() self.retina(False) self.retina_packet_size = None self.image = None self.record_file = None self.count_spike_regions =...
gpl-2.0
BoltzmannBrain/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py
70
4184
""" Render to gtk from agg """ from __future__ import division import os import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ show, draw_if_interactive,\ error_ms...
agpl-3.0
wwf5067/statsmodels
statsmodels/sandbox/multilinear.py
25
13937
"""Analyze a set of multiple variables with a linear models multiOLS: take a model and test it on a series of variables defined over a pandas dataset, returning a summary for each variable multigroup: take a boolean vector and the definition of several groups of variables and test if the group has a f...
bsd-3-clause
lukas/scikit-class
examples/scikit/lstm.py
2
1587
import json from keras.layers import Embedding, LSTM, Dense, Conv1D, MaxPooling1D, Dropout, Activation from keras.models import Sequential from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.utils import np_utils import numpy as np import pandas as pd im...
gpl-2.0
davidwaroquiers/pymatgen
pymatgen/analysis/magnetism/tests/test_heisenberg.py
5
2735
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import os import unittest import warnings import pandas as pd from pymatgen.core.structure import Structure from pymatgen.analysis.magnetism.heisenberg import HeisenbergMapper from pymatgen.util.testing impor...
mit
roshantha9/AbstractManycoreSim
src/analyse_results/AnalyseResults_Exp_HRTVid_varCCR.py
1
13711
import sys, os, csv, pprint, math from collections import OrderedDict import numpy as np import random import shutil import math import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import scipy.stats import itertools from matplotlib.colors import ListedColormap, NoNorm from matplo...
gpl-3.0
tracierenea/gnuradio
gr-digital/examples/example_fll.py
49
5715
#!/usr/bin/env python # # Copyright 2011-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 optio...
gpl-3.0
adrn/ophiuchus
ophiuchus/tests/test_orbitfit.py
1
3417
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Third-party from astropy import log as logger import astropy.units as u import matplotlib.pyplot as pl import numpy as np import gala.potential as gp import gala.integrate as gi import scipy.optimize as so...
mit
hendrikwout/pynacolada
pynacolada/archive.py
1
80243
import glob import os import pandas as pd import xarray as xr import numpy as np import numpy as np import datetime as dt import itertools import yaml import sys from tqdm import tqdm import tempfile from . import apply_func def parse_to_dataframe(list_or_dict_or_dataframe): if type(list_or_dict_or_dataframe) == p...
gpl-3.0
fengzhyuan/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
sukritranjan/ranjansasselov2016b
radiativetransfer_albedo_subfunctions.py
1
10411
# -*- coding: iso-8859-1 -*- """ This script holds the subfunctions used to define the surface albedo for the radiativetransfer_vX.py code. """ import numpy as np import matplotlib.pyplot as plt import pdb import scipy.integrate from scipy import interpolate as interp def get_surface_albedo(wav_left, wav_right, solarz...
mit
vene/ambra
ambra/grid_search.py
1
21548
from abc import ABCMeta, abstractmethod from collections import namedtuple, Sized import warnings import numpy as np from sklearn.base import BaseEstimator, MetaEstimatorMixin, is_classifier, clone from sklearn.grid_search import ParameterGrid, ParameterSampler from sklearn.metrics.scorer import check_scoring from sk...
bsd-2-clause
iABC2XYZ/abc
CM/cmCooorect_3.py
1
12861
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Nov 14 11:46:48 2017 @author: p """ from epics import caget,caput import time import numpy as np import tensorflow as tf import matplotlib.pyplot as plt plt.close('all') filenRec='log_'+time.asctime().replace(' __','_').replace(' ','_')[4:] fid=ope...
gpl-3.0
mne-tools/mne-tools.github.io
0.11/_downloads/plot_label_source_activations.py
32
2269
""" ==================================================== Extracting the time series of activations in a label ==================================================== We first apply a dSPM inverse operator to get signed activations in a label (with positive and negative values) and we then compare different strategies to ...
bsd-3-clause
vitan/blaze
blaze/compute/tests/test_chunks_compute.py
1
4072
from __future__ import absolute_import, division, print_function import pytest import datetime from toolz import map from pandas import DataFrame from toolz import concat from blaze import into from blaze.expr import Symbol, join, by from blaze.compute.core import compute from blaze.compute.chunks import ChunkIterab...
bsd-3-clause
buckiracer/data-science-from-scratch
RefMaterials/Library/gradient.py
1
3873
from functools import partial def sum_of_squares(v): return sum(v_i ** 2 for v_i in v) def difference_quotient(f,x,h): return (f(x+h) - f(x))/ h def square(x): return x * x def derivative(x): return 2 * x derivative_estimate = partial(difference_quotient,square,h=0.00001) # import matplotlib.pyplot as plt ...
unlicense
JohnStarich/github-code-recommendations
data-scripts/word-diff.py
1
4631
#!/usr/bin/env python3 import re import numpy as np import pandas as pd from pymongo import MongoClient from collections import Counter import math from sklearn.metrics import accuracy_score client = MongoClient() db = client.github collection = db.events data = list(collection.find( {"type": "PullRequestEvent", ...
apache-2.0
hyqneuron/pylearn2-maxsom
pylearn2/scripts/datasets/step_through_small_norb.py
49
3123
#! /usr/bin/env python """ A script for sequentially stepping through SmallNORB, viewing each image and its label. Intended as a demonstration of how to iterate through NORB images, and as a way of testing SmallNORB's StereoViewConverter. If you just want an image viewer, consider pylearn2/scripts/show_binocular_gra...
bsd-3-clause
srowen/spark
python/pyspark/sql/tests/test_pandas_udf_typehints.py
22
9603
# # 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
percyfal/snakemakelib
snakemakelib/bio/ngs/qc/qualimap.py
1
6130
# Copyright (C) 2015 by Per Unneberg import pandas as pd import numpy as np from math import log10 from bokeh.plotting import figure, gridplot from bokeh.charts import Scatter from bokehutils.geom import points, abline from bokehutils.facet import facet_grid from bokehutils.axes import xaxis, yaxis, main from snakemake...
mit
rkmaddox/mne-python
tutorials/time-freq/20_sensors_time_frequency.py
10
8158
""" .. _tut-sensors-time-freq: ============================================ Frequency and time-frequency sensor analysis ============================================ The objective is to show you how to explore the spectral content of your data (frequency and time-frequency). Here we'll work on Epochs. We will use th...
bsd-3-clause
feststelltaste/software-analytics
notebooks/lib/ausi/portfolio.py
1
1394
#!/usr/bin/env python # -*- encoding: utf-8 -*- import matplotlib.pyplot as plt def plot_diagram(plot_data, x, y, size='Size'): fig, ax = plt.subplots() ax = plot_data.plot.scatter( x, y, s=plot_data[size] * 100, alpha=0.7, title="SWOT matrix", figsize=[10...
gpl-3.0
Midafi/scikit-image
doc/examples/plot_regionprops.py
23
1297
""" ========================= Measure region properties ========================= This example shows how to measure properties of labelled image regions. """ import math import matplotlib.pyplot as plt import numpy as np from skimage.draw import ellipse from skimage.measure import label, regionprops from skimage.tra...
bsd-3-clause