prompt stringlengths 19 879k | completion stringlengths 3 53.8k | api stringlengths 8 59 |
|---|---|---|
# Lint as: python3
# Copyright 2019 DeepMind Technologies Limited. 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
#
# ... | np.array(generated_vals) | numpy.array |
# -*- coding: utf-8 -*-
import numpy as np
import time
# Rotating hyperplane dataset
def create_hyperplane_dataset(n_samples, n_dim=2, plane_angle=0.45):
w = np.dot(np.array([[np.cos(plane_angle), -np.sin(plane_angle)], [np.sin(plane_angle), | np.cos(plane_angle) | numpy.cos |
"""Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import sys
import numpy as np
from numpy.testing.nosetester import import_nose
from scipy._lib._version import NumpyVersion
if NumpyVersion(np.__version__) > '1.7.0.dev':
_... | np.array(array, copy=False, subok=subok) | numpy.array |
from linlearn import BinaryClassifier, MultiClassifier
from linlearn.robust_means import Holland_catoni_estimator, gmom, alg2
import numpy as np
import gzip
import logging
import pickle
from datetime import datetime
import sys
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from scipy.special ... | np.random.randint(X.shape[0]) | numpy.random.randint |
import numpy as np
import scipy.stats
import os
import logging
from astropy.tests.helper import pytest, catch_warnings
from astropy.modeling import models
from astropy.modeling.fitting import _fitter_to_model_params
from stingray import Powerspectrum
from stingray.modeling import ParameterEstimation, PSDParEst, \
... | np.ones(nsim) | numpy.ones |
"""Test correlation and distance correlation estimators."""
import numpy as np
from frites.estimator import CorrEstimator, DcorrEstimator
array_equal = np.testing.assert_array_equal
class TestCorrEstimator(object):
def test_corr_definition(self):
"""Test definition of correlation estimator."""
... | np.random.rand(100) | numpy.random.rand |
# Copyright 2018 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 or at
# https://developers.google.com/open-source/licenses/bsd
from __future__ import absolute_import
from __future__ import division
from __future__ import p... | np.array(y_test) | numpy.array |
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, ... | ndpointer(dtype=c_int32) | numpy.ctypeslib.ndpointer |
import argparse
import os
import pickle as pkl
import numpy as np
import scipy.sparse as smat
from pecos.core.base import clib
from pecos.utils import smat_util
from pecos.utils.cluster_util import ClusterChain
from pecos.xmc import MLModel
from pecos.xmc.xlinear import XLinearModel
def parse_arguments():
parser... | np.intersect1d(S1, K1) | numpy.intersect1d |
# This module has been generated automatically from space group information
# obtained from the Computational Crystallography Toolbox
#
"""
Space groups
This module contains a list of all the 230 space groups that can occur in
a crystal. The variable space_groups contains a dictionary that maps
space group numbers an... | N.array([1,2,2]) | numpy.array |
"""
Implement optics algorithms for optical phase tomography using GPU
<NAME> <EMAIL>
<NAME> <EMAIL>
October 22, 2018
"""
import numpy as np
import arrayfire as af
import contexttimer
from opticaltomography import settings
from opticaltomography.opticsmodel import MultiTransmittance, MultiPhaseContrast
from op... | np.array(fields["back_scattered_field"]) | numpy.array |
# coding: utf-8
# ### Compute results for task 1 on the humour dataset.
#
# Please see the readme for instructions on how to produce the GPPL predictions that are required for running this script.
#
# Then, set the variable resfile to point to the ouput folder of the previous step.
#
import string
import pandas as p... | np.unique(pair_ids) | numpy.unique |
# -*- coding: utf-8 -*-
from . import plot_settings as pls
from . import plots as pl
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import logging
from matplotlib.colors import LinearSegmentedColormap, colorConverter
from scipy.stats.kde import gaussian_kde
try:
from scipy... | np.atleast_1d(x) | numpy.atleast_1d |
from __future__ import division
import pytest
import numpy as np
import cudf as pd
import fast_carpenter.masked_tree as m_tree
@pytest.fixture
def tree_no_mask(infile, full_event_range):
return m_tree.MaskedUprootTree(infile, event_ranger=full_event_range)
@pytest.fixture
def tree_w_mask_bool(infile, event_rang... | np.where(mask) | numpy.where |
import pytest
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.metrics.tests.test_ranking import make_prediction
from sklearn.utils.validation import check_consistent_length
from mcc_f1 import mcc_f1_curve
def test_mcc_f1_curve():
# Test MCC and F1 values for all points of the... | np.array([1 if di == 0 else di for di in d]) | numpy.array |
import re
import os
import numpy as np
import pandas as pd
import scipy.stats as sps
pd.options.display.max_rows = 4000
pd.options.display.max_columns = 4000
def write_txt(str, path):
text_file = open(path, "w")
text_file.write(str)
text_file.close()
# SIR simulation
def sir(y, alpha, beta, gamma, nu,... | np.diff(r) | numpy.diff |
import numpy as np
import matplotlib.pyplot as plt
import os
import warnings
from datetime import date
from math import e
def calc_rate(data1, data2):
if(data2 == 0):
return data1
else:
if(data1 < data2):
return (data2 / data1) * -1
else:
return data1 / data2
de... | np.set_printoptions(precision=3) | numpy.set_printoptions |
################################################################################
# Copyright (c) 2009-2019, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the... | np.sqrt(1.0 + 2.0 * e2 ** 2 * P) | numpy.sqrt |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4