Saravanan666/pypi-org huggingface dataset:
Package: opt3001
Opt3001Python support library for the light sensor OPT3001 from Texas InstrumentsDescriptionContentsDescriptionContentsInstallUsageFlight ManualDevelopmentTeamLicenseInstallsudo apt-get install -y python-smbuspip install opt3001Usageimportopt3001fromopt3001address=0x44opt=opt3001.OPT3001(address)# Configure to run in Continuous conversions modeopt3001.write_config_reg(opt3001.I2C_LS_CONFIG_CONT_FULL_800MS)while(True):print(opt3001.read_lux_float())time.sleep(1)Raspberry piAdd following line to/etc/modulesto start i2c module on startup:i2c_devRun following commands to start the i2c modules manually:$modprobei2c-bcm2708
$modprobei2c_devInstalli2c-toolsto test with the terminal$sudoapt-getinstalli2c-toolsRun following command to get the address of the opt3001$i2cdetect-y10123456789abcdef00:--------------------------10:--------------------------------20:--------------------------------30:--------------------------------40:--------44----------------------50:--------------------------------60:--------------------------------70:----------------Run the following command to test the opt30001$i2cget-y10x440x00

0x0bFlight ManualConstantsOPT3001constructor(address, bus = 1)write_config_reg()read_lux_fixpoint()read_lux_floatDevelopmentBuildpython setup.py sdist bdist_wheelUploadtwine upload dist/*TeamThomas Pöhlmann(@perryrh0dan)LicenceMITThis repository was generated bycharon
Package: opt4py
opt4pyAdds to Python anOptioncontainer class that handles seamlessly NoneType checks in a monadic way. Similar toOptionin Rust orOptionalin Java, but it also overloads every operator for a smooth use without worries.Usage>>>fromopt4pyimportOption>>>Option(1)Option(1)>>>Option("Hello World!")Option(HelloWorld!)>>>Option()Option(None)>>>Option(1)+1Option(2)>>>Option(2)*Option(2)Option(4)>>>Option(5).unwrap()5>>>Option(8).map(lambdax:x*2)Option(16)>>>Option(2)==2True>>>Option(2)>3False
Package: optax-adan
optax-adanAn implementation of adan optimizer foroptaxbased onAdan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models.Collab with usage example can be foundhere.How to use:Install the package:python3-mpipinstalloptax-adanImport the optimizer:fromoptax_adanimportadanUse it as you would use any other optimizer from optax:# initoptimizer=adan(learning_rate=0.01)optimizer_state=optimizer.init(initial_params)# stepgrad=grad_func(params)updates,optimizer_state=optimizer.update(grad,optimizer_state,params)params=optax.apply_updates(params,updates)
Package: optax-shampoo
Optimization in machine learning, both theoretical and applied, is presently dominated by first-order gradient methods such as stochastic gradient descent. Second-order optimization methods, that involve second derivatives and/or second order statistics of the data, are far less prevalent despite strong theoretical properties, due to their prohibitive computation, memory and communication costs.Here we present a scalable implementation of a second-order preconditioning method (concretely, a variant of full-matrix Adagrad) that provides significant convergence and wall-clock time improvements compared to conventional first-order methods on state-of-the-art deep models.Paper preprints:https://arxiv.org/abs/2002.09018
Package: optax-swag
SWAG in OptaxThis package implementsSWAGas anOptaxtransform to allow
usage withJAX.InstallationInstall frompipas:pipinstalloptax-swagTo install the latest directly from source, runpipinstallgit+https://github.com/activatedgeek/optax-swag.gitUsageTo start updating the iterate statistics, usechainingasimportoptaxfromoptax_swagimportswagoptimizer=optax.chain(...## Other optimizer and transform config.swag(freq,rank)## Always add as the last transform.)TheSWAGStateobject can be accessed from
the optimizer state list for downstream usage.SamplingA reference code to generate samples from the collected statistics
is provided below.importjaximportjax.numpyasjnpfromoptax_swagimportsample_swagswa_opt_state=# Reference to a SWAGState object from the optimizer.n_samples=10rng=jax.random.PRNGKey(42)rng,*samples_rng=jax.random.split(rng,1+n_samples)swag_sample_params=jax.vmap(sample_swag,in_axes=(0,None))(jnp.array(samples_rng),swa_opt_state)The resultingswag_sample_paramscan now be used for downstream evaluation.NOTE: Make sure to update non-parameter variables (e.g. BatchNorm running statistics) for each generated sample.LicenseApache 2.0
Package: optbinning
The optimal binning is the optimal discretization of a variable into bins
given a discrete or continuous numeric target. OptBinning is a library
written in Python implementing a rigorous and flexible mathematical
programming formulation to solving the optimal binning problem for a binary,
continuous and multiclass target type, incorporating constraints not
previously addressed.Read the documentation at:http://gnpalencia.org/optbinning/OptBinning is distributed under the Apache Software License (Apache 2.0).
Package: optboolnet
# optboolnetThe optimization toolbox for Boolean network analysis## Docker distribution### Build docker image` docker build-tmso_lab/colomoto-optboolnet:v0. `### Launch CoLoMoTo Notebook` python-mpip install-Ucolomoto-dockercolomoto-docker--imagemso_lab/colomoto-optboolnet-Vv0--bind. `Note: A Gurobi [Web License Service](https://license.gurobi.com/manager/doc/overview/) (WLS)gurobi.licmust be in the working directoy.
Package: optcat
OptCATOptCAT (=Optuna+CatBoost) provides a scikit-learn compatible estimator that tunes hyperparameters in CatBoost with Optuna.This Repository is very influenced byY-oHr-N/OptGBM.Examplesfrom optcat.core import CatBoostClassifier
from sklearn import datasets

params = {
        "bootstrap_type": "Bayesian",
        "loss_function": "Logloss",
        "iterations": 100
    }

model = CatBoostClassifier(params=params, n_trials=5)
data, target = datasets.load_breast_cancer(return_X_y=True)
model.fit(X=data, y=target)Installationpip install git+https://github.com/wakamezake/OptCAT.gitTestingpoetry run pytest
Package: optcomplete
This module provide automatic bash completion support for programs that use the
optparse module.  The premise is that the optparse options parser specifies
enough information (and more) for us to be able to generate completion strings
esily.  Another advantage of this over traditional completion schemes where the
completion strings are hard-coded in a separate bash source file, is that the
same code that parses the options is used to generate the completions, so the
completions is always up-to-date with the program itself.In addition, we allow you specify a list of regular expressions or code that
define what kinds of files should be proposed as completions to this file if
needed.  If you want to implement more complex behaviour, you can instead
specify a function, which will be called with the current directory as an
argument.You need to activate bash completion using the shell script function that comes
with optcomplete (seehttp://furius.ca/optcompletefor more details).
Package: optconvert
OPTCONVERTConverter for mathematical optimization formats: .mpl, .lp, .xa, .sim, .mpl, .gms, .mod, .xml, .mat.Explore the docsReport Bug-Request FeatureTable of ContentsAbout the ProjectBuilt WithGetting StartedPrerequisitesInstallationUsageRoadmapContributingLicenseContactAcknowledgementsAbout The ProjectEveryone who works with mathematical optimization problems knows what pain in the *** it can be
to convert problems from one file format into another. Often ad-hoc solutions for the specific test set
must be created to read the instances.This packages provides the unified interface for converting optimization models between popular formats:.mps (incl. smps as three files: .cor, .sto, .tim).lp (CPLEX format).xa.sim.mpl.gms.mod.xml.mat.cPackage can be used as the module in Python or as the command line interface (CLI).Built WithPython 3.6OptiMax Component LibraryGetting StartedTo get a local copy up and running follow these simple steps.Prerequisitespython 3.6scipymatplotlibwxpythonmplpyInstallation from PyPIInstall scipy, matplotlib and wxpythonpip install scipy, matplotlib, wxpythonInstall mplpyDownload and install thefull/academicorstudentversion of MPLInstall OptiMax Library. On Windows installation file is located in C:\Mplwin\50\setup\PythonInstall optconvertpip install optconvertInstallation from GitHub repoInstall scipy, matplotlib and wxpythonpip install scipy, matplotlib, wxpythonInstall mplpyDownload and install thefull/academicorstudentversion of MPLInstall OptiMax Library. On Windows installation file is located in C:\Mplwin\50\setup\PythonClone the repogit clone https://github.com/pashtetgp/optconvert.gitcd to project folder and install the packagecd C:\optconvert
pip install ..\optconvertUninstallrun in command linepip uninstall optconvertUsageAs Python moduleSee class docstrings for details.from optconvert import Model
from pathlib import Path

in_file = Path('Dakota_det.mpl')
model = Model(in_file)
print('Solution: ' + str(model.solve()))
out_file = in_file.with_suffix('lp')
model.export(out_file)Via CLIChange the directory to the folder with model files and runoptconvert.
One or multiple files can be converted at once.CLI mode accepts --file and --out_format argumentsRoadmapSee theopen issuesfor a list of proposed features (and known issues).ContributingAny contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestLicenseDistributed under the MIT License. SeeLICENSEfor more information.ContactPavlo GlushkoProject Link:https://github.com/pashtetgp/optconvertAcknowledgementsIcons byFreepikfromwww.flaticon.comReadme template fromothneildrew
Package: optcutfreq
optcutfreqAutomatic search of optimal filter cutoff frequency based on residual analysisThe 'optimal' cutoff frequency (in the sense that a filter with such cutoff frequency removes as much noise as possible without considerably affecting the signal) is found by performing a residual analysis of the difference between filtered and unfiltered signals over a range of cutoff frequencies.The optimal cutoff frequency is the one where the residual starts to change very little because it is considered that from this point, it's being filtered mostly noise and minimally signal, ideally.InstallationpipinstalloptcutfreqOrcondainstall-cduartexyzoptcutfreqExamples>>>y=np.cumsum(np.random.randn(1000))>>># optimal cutoff frequency based on residual analysis and plot:>>>fc_opt=optcutfreq(y,freq=1000,show=True)>>># sane analysis but specifying the frequency limits and plot:>>>optcutfreq(y,freq=1000,fclim=[200,400],show=True)>>># It's not always possible to find an optimal cutoff frequency>>># or the one found can be wrong (run this example many times):>>>y=np.random.randn(100)>>>optcutfreq(y,freq=100,show=True)In a Jupyter notebookHow to cite this workHere is a suggestion to cite this GitHub repository:Duarte, M. (2020) optcutfreq: Automatic search of optimal filter cutoff frequency based on residual analysis. GitHub repository,https://github.com/demotu/optcutfreq.And a possible BibTeX entry:@misc{Duarte2020,  
    author ={Duarte, M.},
    title ={optcutfreq: Automatic search of optimal filter cutoff frequency based on residual analysis},  
    year ={2020},  
    publisher ={GitHub},  
    journal ={GitHub repository},  
    howpublished ={\url{https://github.com/demotu/optcutfreq}}}LicenseThe non-software content of this project is licensed under aCreative Commons Attribution 4.0 International License, and the software code is licensed under theMIT license.
Package: optdash
optdashOptdashis a third-party dashboard for optuna.Key featuresSimple usageInteractive visualizationMinimal dependenciesOptdash depends solely on Optuna (and sklearn, which is an optional depedency of optuna).Quick startoptdashyour/db/urlThe db url is the same with optuna, whose format followsRFC-1738.InstallFrom pypipipinstalloptdashFrom sourcecdoptdash/frontend
npmi
npmrunbuildcd../../
python-mpipinstall.
Package: opt-einsum
Optimized Einsum: A tensor contraction order optimizerOptimized einsum can significantly reduce the overall execution time of einsum-like expressions (e.g.,np.einsum,dask.array.einsum,pytorch.einsum,tensorflow.einsum,
)
by optimizing the expression's contraction order and dispatching many
operations to canonical BLAS, cuBLAS, or other specialized routines. Optimized
einsum is agnostic to the backend and can handle NumPy, Dask, PyTorch,
Tensorflow, CuPy, Sparse, Theano, JAX, and Autograd arrays as well as potentially
any library which conforms to a standard API. See thedocumentationfor more
information.Example usageTheopt_einsum.contractfunction can often act as a drop-in replacement foreinsumfunctions without futher changes to the code while providing superior performance.
Here, a tensor contraction is preformed with and without optimization:importnumpyasnpfromopt_einsumimportcontractN=10C=np.random.rand(N,N)I=np.random.rand(N,N,N,N)%timeitnp.einsum('pi,qj,ijkl,rk,sl->pqrs',C,C,I,C,C)1loops,bestof3:934msperloop%timeitcontract('pi,qj,ijkl,rk,sl->pqrs',C,C,I,C,C)1000loops,bestof3:324usperloopIn this particular example, we see a ~3000x performance improvement which is
not uncommon when compared against unoptimized contractions. See thebackend
examplesfor more information on using other backends.FeaturesThe algorithms found in this repository often power theeinsumoptimizations
in many of the above projects. For example, the optimization ofnp.einsumhas been passed upstream and most of the same features that can be found in
this repository can be enabled withnp.einsum(..., optimize=True). However,
this repository often has more up to date algorithms for complex contractions.The following capabilities are enabled byopt_einsum:Inspectdetailed informationabout the path chosen.Perform contractions withnumerous backends, including on the GPU and with libraries such asTensorFlowandPyTorch.Generatereusable expressions, potentially withconstant tensors, that can be compiled for greater performance.Use an arbitrary number of indices to find contractions forhundreds or even thousands of tensors.Shareintermediate computationsamong multiple contractions.Compute gradients of tensor contractions usingautogradorjaxPlease see thedocumentationfor more features!Installationopt_einsumcan either be installed viapip install opt_einsumor from condaconda install opt_einsum -c conda-forge. See the installationdocumenationfor further methods.CitationIf this code has benefited your research, please support us by citing:Daniel G. A. Smith and Johnnie Gray, opt_einsum - A Python package for optimizing contraction order for einsum-like expressions.Journal of Open Source Software,2018, 3(26), 753DOI:https://doi.org/10.21105/joss.00753ContributingAll contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.A detailed overview on how to contribute can be found in thecontributing guide.
Package: opt-einsum-fx
opt_einsum_fxOptimizing einsums and functions involving them usingopt_einsumand PyTorchFXcompute graphs.Issues, questions, PRs, and any thoughts about further optimizing these kinds of operations are welcome!For more information please seethe docs.InstallationPyPIThe latest release can be installed from PyPI:$pipinstallopt_einsum_fxSourceTo get the latest code, run:$gitclonehttps://github.com/Linux-cpp-lisp/opt_einsum_fx.gitand install it by running$cdopt_einsum_fx/
$pipinstall.You can run the tests with$pytesttests/Minimal exampleimporttorchimporttorch.fximportopt_einsum_fxdefeinmatvecmul(a,b,vec):"""Batched matrix-matrix-vector product using einsum"""returntorch.einsum("zij,zjk,zk->zi",a,b,vec)graph_mod=torch.fx.symbolic_trace(einmatvecmul)print("Original code:\n",graph_mod.code)graph_opt=opt_einsum_fx.optimize_einsums_full(model=graph_mod,example_inputs=(torch.randn(7,4,5),torch.randn(7,5,3),torch.randn(7,3)))print("Optimized code:\n",graph_opt.code)outputsOriginal code:
import torch
def forward(self, a, b, vec):
    einsum_1 = torch.functional.einsum('zij,zjk,zk->zi', a, b, vec);  a = b = vec = None
    return einsum_1

Optimized code:
import torch
def forward(self, a, b, vec):
    einsum_1 = torch.functional.einsum('cb,cab->ca', vec, b);  vec = b = None
    einsum_2 = torch.functional.einsum('cb,cab->ca', einsum_1, a);  einsum_1 = a = None
    return einsum_2We can measure the performance improvement (this is on a CPU):fromtorch.utils.benchmarkimportTimerbatch=1000a,b,vec=torch.randn(batch,4,5),torch.randn(batch,5,8),torch.randn(batch,8)g={"f":graph_mod,"a":a,"b":b,"vec":vec}t_orig=Timer("f(a, b, vec)",globals=g)print(t_orig.timeit(10_000))g["f"]=graph_optt_opt=Timer("f(a, b, vec)",globals=g)print(t_opt.timeit(10_000))gives ~2x improvement:f(a, b, vec)
  276.58 us
  1 measurement, 10000 runs , 1 thread

f(a, b, vec)
  118.84 us
  1 measurement, 10000 runs , 1 threadDepending on your function and dimensions you may see even larger improvements.Licenseopt_einsum_fxis distributed under anMIT license.
Package: opt-einsum-torch
opt-einsum-torchThere have been many implementations of Einstein's summation. numpy'snumpy.einsumis the least efficient one as it only runs in single thread on
CPU. PyTorch'storch.einsumworks for both CPU and CUDA tensors. However,
since there is no virtual CUDA memory,torch.einsumwill run out of CUDA
memory for large tensors.This code aims at implementing a memory-efficienteinsumfunction using
PyTorch as the backend. This code also uses theopt_einsumpackage to
optimizes the contraction path to achieve the minimal FLOPS.Usagefromopt_einsum_torchimportEinsumPlannerimporttorch# Some huge tensorsarr1,arr2=...,...ee=EinsumPlanner(torch.device('cuda:0'),cuda_mem_limit=0.9)result=ee.einsum('ijk,jkl->il',arr1,arr2)The resulting tensorresultwill be a PyTorch CPU tensor. You could convert
it into numpy array by simply callingresult.numpy().Future worksSupport multiple GPUs.Memory efficient einsum kernels.CUDA data transfer profilers.
Package: optgraphstate
OptGraphStateVersion 0.3.1Graph-theoretical optimization of fusion-based graph state generation.OptGraphStateis a python package that implements the graph-theoretical strategy to optimize the fusion-based
generation of any graph state, which is proposed
inLee & Jeong, arXiv:2304.11988 [quant-ph] (2023).The package has the following features:Finding a resource-efficient method of generating a given graph state through type-II fusions from multiple basic
resource states, which are three-qubit linear graph states.Computing the corresponding resource overhead, which is quantified by the average number of required basic resource
states or fusion attempts.Computing the success probability of graph state generation when the number of provided basic resource states is
limited.Visualizing the original graph (of the graph state you want to generate), unraveled graphs, and fusion networks. An
unraveled graph is a simplified graph where the corresponding graph state is equivalent to the desired graph state up
to fusions and single-qubit Clifford operations. A fusion network is a graph that instructs the fusions between basic
resource states required to generate the desired graph state.Various predefined sample graphs for input.Installationpip install optgraphstateManualsTutorials:https://github.com/seokhyung-lee/OptGraphState/raw/main/tutorials.pdfAPI reference:https://seokhyung-lee.github.io/OptGraphStateLicenseOptGraphState is distributed under the MIT license. Please see the LICENSE file for more details.CitationIf you want to cite OptGraphState in an academic work, please cite the arXiv preprint:@misc{lee2023graph,
      title={Graph-theoretical optimization of fusion-based graph state generation}, 
      author={Seok-Hyung Lee and Hyunseok Jeong},
      year={2023},
      eprint={2304.11988},
      archivePrefix={arXiv},
      primaryClass={quant-ph},
      url={https://arxiv.org/abs/2304.11988}
}
Package: optht
Optimal Hard Threshold for Matrix DenoisingOff-the-shelf method for determining the optimal singular value truncation
(hard threshold) for matrix denoising.The method gives the optimal location both in the case of the known or unknown
noise level.ExampleReproduce the exampleCreate some data:importnumpyasnpimportscipyassciimportmatplotlib.pyplotaspltfromopthtimportopthtt=np.arange(-2,2,0.01)Utrue=np.array(([np.cos(17*t)*np.exp(-t**2),np.sin(11*t)])).TStrue=np.array(([2,0],[0,.5]))Vtrue=np.array(([np.sin(5*t)*np.exp(-t**2),np.cos(13*t)])).T# construct imageX=Utrue.dot(Strue).dot(Vtrue.T)# define the noise level and addsigma=0.5X_noisy=X+sigma*np.random.standard_normal(X.shape)Compute the singular value decomposition (SVD):U,s,Vh=np.linalg.svd(X_noisy,full_matrices=False)Determine optimal hard threshold and reconstruct imagek=optht(X_noisy,sv=s,sigma=None)X_denoised=(U[:,range(k)]*s[range(k)]).dot(Vh[range(k),:])Plot the results:plt.subplot(131)plt.imshow(X,cmap='gray',interpolation='bicubic')plt.title('Original image')plt.axis('off')plt.subplot(132)plt.imshow(X_noisy,cmap='gray',interpolation='bicubic')plt.title('Noisy image, sigma=%s'%sigma)plt.axis('off')plt.subplot(133)plt.imshow(X_denoised,cmap='gray',interpolation='bicubic')rmseSVD=np.sqrt(np.sum((X-X_denoised)**2)/np.sum(X**2))plt.title('Denoised image,  nrmse=%s'%np.round(rmseSVD,2))plt.axis('off')plt.show()Plot the singular value spectrum:plt.plot((np.arange(1,s.shape[0]+1)),np.log(s),c='b',marker='o',linestyle='--')plt.xlabel('k',fontsize=25)plt.ylabel('Log-scaled singular values')plt.tick_params(axis='x')plt.tick_params(axis='y')plt.title('Singular value spectrum')plt.axvline(k,c='r',linewidth=2,linestyle='--')plt.show()Authors & AcknowledgmentsThanks to Steven Dahdah for refactoring the code into a Python package.Thanks to Bill Tubbs for style edits and a few typo corrections.Thanks to  @nish-ant for adding fixes to make the code Python 3 compatible.NotesCode is adapted from Matan Gavish and David L. Donoho, see [1].
Corresponding MATLAB code can be foundhereReferences[1] Gavish, Matan, and David L. Donoho.
"The optimal hard threshold for singular values is 4/sqrt(3)"
IEEE Transactions on Information Theory 60.8 (2014): 5040-5053.http://arxiv.org/abs/1305.5870
Package: opthub-evaluator
OptHub EvaluatorOptHub Evaluator is a worker program that evaluates a solution submitted to OptHub.RequirementsPython >=3.6Docker >=1.12See alsorequirements.txtfor dependent python packages.Installation$ pip install opthub-evaluatorUsageHow to start an evaluatorLogin the docker registry where the problem image is stored.$ docker login <registry>Start an evaluator.$ opthub-evaluatorOptionsParameterTypeDefaultDescriptionurlpathhttps://opthub-api.herokuapp.com/v1/graphqlURL to OptHubapikeystrApiKeyintervalint2Polling intervalverify/no-verifyboolTrueVerify SSL certificateretriesint3Retries to establish HTTPS connectiontimeoutint600Timeout to process a queryrmRemove containers after exitquietBe quieterverboseBe more verboseconfigpathopthub-evaluator.ymlConfiguration fileHow to make an problem imageWrite a problem program in your favorite language.Dockerize it.Push the docker image to DockerHub or somewhere else accessible from OptHub.
For this purpose, OptHub hosts its own docker private registry.Register the image tag to OptHub.See alsoexample.AuthorNaoki Hamada (hmkz@s101.xrea.com)LicenseMIT