Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I'm a novice in AI & ML, and I always see
"import numpy as np"
So, I really want to know when is the usage of numpy? and what is the usage of it?
Ideally, when do we have to include in our code and be prepared for this library
Numpy is a python library and it has a variety of use cases. It actually depends on the scenario you are working on.
As a novice ML learner myself, Numpy can prove to very useful when you work with ML algorithms, which typically involve working with arrays. Numpy tends to more versatile when compared to the traditional python List. Numpy offers the following features:
Smaller Memory Consumption than List
Implementation of Multi-Dimensional Arrays
NumPy arrays are faster than Python List
NumPy can be used to transform the Arrays Python does not have inbuilt support for Arrays Offers function like Reshape, Sort, Reverse, etc.
Usually, you have will have to deal with a lot to arrays of varying sizes and might have to sort or reshape. Numpy is very useful in that case
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am trying to perform test summarize using self organizing map (SOM) as the clustering model. Do we have any libraries for performing SOM in python.
There is one here, but in general SOM implementations are not part of the main machine learning libraries. There are two reasons
SOM's, although nice to look at, don't really perform well in real problems.
It is too easy to construct one by yourself.
I would suggest to make it yourself. It is very easy and a great way to introduce yourself to python. The main code of the SOM itself is about 3 lines (a loop and one update). The remaing of the code would be for loading the data and plotting them, but you won't avoid that part of the code by using an external library
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 months ago.
Improve this question
I saw many examples of SIFT for 2-dimensional image only: http://docs.opencv.org/3.1.0/da/df5/tutorial_py_sift_intro.html. But in Wikipedia there is written that SIFT may be applied for "3D modelling" as well. Please help me to find examples for 3-dimensional image in Python, or provide me the ones of your own. I need to find locations of Amino Acids within given protein (creo EM scan), and I want to compare precision of SIFT compared to other heuristics calculations.
If you need to do some 3D program, I suggest you to look at this great library: Point Cloud Library (PCL). However, I think you might need to program in C++ mainly.
If you really like to code in Python, you could look at the python-pcl. It is a python binding to the subset of actual Point Cloud Library.
And if you like to find how to use 3D keypoint detectors, including 3D sift, you can look at this page here and a nice tutorial here.
There is a 3D SIFT implementation on GitHub: SIFT3D
It is implemented in C but it has a CLI, so it is possible to call from Python.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I would like to make a numpy-like multi-dimensional array of non-numerical objects in python. I believe Numpy arrays only allow numerical values. List-of-lists are much less convenient to index- for example, I'd like to be able to ask for myarray[1,:,2] which requires much more complicated calls from lists of lists.
Is there a good tool for this?
NumPy arrays actually do allow non-numerical contents, so you can just use NumPy.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm doing some development in Python, mostly using a simple text editor (Sublime Text). I'm mostly dealing in databases that I fit in Pandas DataFrames. My issue is, I often lose track of the column names, and occasionally the column types as well. Is there some IDE / plug-in / debug tool that would allow me to look into each DataFrame and see how it's defined, a little bit like Eclipse can do for Java classes?
Thank you,
I don't believe that something like that exists, but you can always use df.info().
You're looking for Spyder, at least that's the one that I currently use. Not sure if other ones have the same capabilities.
It has matlab like features that allows you to view your variables and a great tool for numpy arrays and pandas dataframes.
Here's an example:
import numpy as np
import pandas as pd
foo = 7
arr = np.array([0,5,9])
df = pd.DataFrame(arr).T
df.columns = ['spam','eggs','bar']
In the Variable Explorer you'll see the following:
Here's a view of the dataframe (double click). Can also be done to arrays:
Note: For numpy arrays you can change from showing max/min to truncated values, to full array.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I have been looking for a python module that implements the common techniques of global optimization (finding the global minimum of a function in N dimensions) without success.
If you heard about a simulated annealing or genetic algorithm implementation in python, please share.
Scipy's optimize module has a dual_annealing function that might fit your needs. Also, you should check out the PyEvolve module for doing a genetic algorithm.
I'm not an expert, but have you looked at:
Scipy's optimize: http://docs.scipy.org/doc/scipy/reference/optimize.html#global
NLOpt: http://ab-initio.mit.edu/wiki/index.php/NLopt_Introduction
OpenOpt: http://openopt.org/Foreword
One of the most common is scipy.optimize.
For genetic algorithms, there's pygene.
Also, the aima-python project has implementations of algorithms described in Russell and Norvig's "Artificial Intelligence: A Modern Approach".
I've been working on a detailed comparison of many python global optimizers (I assume you are interested in derivative-free optimization where there are plenty of local minima).
hyperopt
optuna
pysot
scipy.optimize
pymoo
many more (see list of some I left out)
To summarize, I'd recommend scipy.optimize and if you're in dimension less than say ten, the SHGO algorithm therein is really solid. You might want to read up on it if you have a passing interest in homology. It is better than some previous ones, such as basin-hopping, because it cleverly tries to avoid redundant local searches.
The full list and comparisons are in the report
Simulated Annealing:
frigidum is a python package for simulated annealing.