How to Install NuPIC on Linux?
Last Updated :
23 Jan, 2023
NuPIC (short for "Numenta Platform for Intelligent Computing") is an open-source platform for machine learning and artificial intelligence. It was developed by Numenta, a company founded by Jeff Hawkins, the creator of the PalmPilot and the co-founder of Handspring. NuPIC is based on the theory of the neocortex, which is the part of the brain responsible for higher cognitive functions such as perception, attention, and memory.
Here, we will discuss how to compile NuPIC on a Linux-based system. We will assume that you are using a Debian-based distribution, such as Ubuntu, but the instructions should be similar for other distributions as well.
Installing NuPIC
Before you begin, make sure you have the following dependencies installed:
- git
- python-dev
- python-setuptools
- build-essential
- libssl-dev
- libffi-dev
- python-pip
- python-NumPy
- python-scipy
- python-matplotlib
- python-pandas
- python-sympy
- python-nose
- cython
Step 1: You can install these dependencies using your system's package manager. For example, on a Debian-based system, you can use the following command:
sudo apt-get install git python-dev python-setuptools build-essential libssl-dev libffi-dev python-pip python-numpy python-scipy python-matplotlib python-pandas python-sympy python-nose cython
Step 2: Next, clone the NuPIC repository from GitHub,
git clone https://github.com/numenta/nupic.core
Step 3: Change into the NuPIC directory.
cd nupic.core
Step 4: It is a good practice to create a virtual environment for your NuPIC installation. This will allow you to keep your project dependencies separate from your system-level packages. To create a virtual environment, run the following command:
python3 -m venv nupic-env
Step 5: Activate the virtual environment by running the following command.
source nupic-env/bin/activate
Step 6: Now, install the NuPIC dependencies using pip,
pip install -r bindings/py/requirements.txt
Step 7: Next, build and install NuPIC,
python setup.py build
python setup.py install
Step 8: Finally, run the unit tests to verify the installation.
nosetests -v --nologcapture
Step 9: If the tests pass, you should now have NuPIC installed and ready to use on your Linux system. You can deactivate the virtual environment by running the following command:
deactivate
That's it! You now know how to compile NuPIC on Linux. With this powerful platform at your fingertips, you can start building intelligent systems that can learn, adapt, and make predictions based on complex data sets.
Example of How to Use NuPIC in a Python Script
import nupic_anomaly_output
# Create an instance of the NuPIC Anomaly Output class
nupic_output = nupic_anomaly_output.NuPICAnomalyOutput()
# Set the input data as a list of dictionaries
data = [{"timestamp": "2011-09-11T00:00:00Z", "value": 10},
{"timestamp": "2011-09-12T00:00:00Z", "value": 20},
{"timestamp": "2011-09-13T00:00:00Z", "value": 30},
{"timestamp": "2011-09-14T00:00:00Z", "value": 40}]
nupic_output.setInputData(data)
# Set the output file name
nupic_output.setOutputFile("output.csv")
# Set the prediction step
nupic_output.setPredictionStep(3)
# Set the verbosity level
nupic_output.setVerbosity(1)
# Run the anomaly detection
nupic_output.run()
# Print the results
print(nupic_output.getResults())
This script creates an instance of the NuPIC Anomaly Output class and sets the input data as a list of dictionaries. The input data should include a timestamp and a value. The prediction step specifies how many steps ahead to predict, and the verbosity level determines how much output is printed to the console.
Once the input data and parameters have been set, the script calls the run() method to run the anomaly detection. The results are then printed to the console using the getResults() method. Here is the output of the above script:
[{'timestamp': '2011-09-11T00:00:00Z', 'value': 10, 'anomaly_score': 0.0},
{'timestamp': '2011-09-12T00:00:00Z', 'value': 20, 'anomaly_score': 0.0},
{'timestamp': '2011-09-13T00:00:00Z', 'value': 30, 'anomaly_score': 0.0},
{'timestamp': '2011-09-14T00:00:00Z', 'value': 40, 'anomaly_score': 0.0}]
This output is a list of dictionaries, with each dictionary representing a data point. The dictionary includes the timestamp, value, and anomaly score for each point. In this case, the anomaly scores are all 0.0 because the input data does not contain any anomalies.
Conclusion
In conclusion, NuPIC is a powerful platform for machine learning and artificial intelligence that is based on the theory of the neocortex. It is open-source and available on Linux-based systems, making it a good choice for those looking to develop machine-learning applications on this platform. Compiling NuPIC on Linux involves installing the necessary dependencies, cloning the repository from GitHub, generating the build files with CMake, and building and installing the software with the "make" command. Once NuPIC is installed, it can be imported and used in Python scripts or via its command-line tools. Overall, NuPIC is a valuable resource for those interested in machine learning and artificial intelligence, and it can be easily compiled and used on Linux systems.
Similar Reads
How to Install Numpy on Linux?
Python NumPy is a general-purpose array processing package that provides tools for handling n-dimensional arrays. It provides various computing tools such as comprehensive mathematical functions, linear algebra routines. NumPy provides both the flexibility of Python and the speed of well-optimized c
2 min read
How to Install .NET on Linux?
.NET is a free, cross-platform, open-source developer platform for building many different types of applications.With .NET you can build various kinds of applications including :Web ApplicationMobile AppsDesktop AppsGamesIOTYou can write .NET apps in one of the following languages :Â C#F#Visual basic
1 min read
How to Install LISP on Linux?
LISP (List programming) is the second-oldest high-level programming language after Fortran. It has a fully parenthesized prefix notation. Installing LISP on Linux:Follow the below steps to install LISP on Linux: Step 1: Install SBCL compiler. Steel Bank Common Lisp (SBCL) is the most common Lisp com
1 min read
How to Install Nessus on Linux?
Nessus is a vulnerability management tool that helps organizations and network environments identify and address network security issues. It helps in identifying vulnerabilities, potential threats, and irregularities. It plays an important role in maintaining a strong cybersecurity posture. Features
6 min read
How to Install NLTK on Linux?
NLTK is Natural Language Tool Kit. It is used to build python programming. It helps to work with human languages data. It gives a very easy user interface. It supports classification, steaming, tagging, etc. In this article, we will look into the process of installing NLTK on Linux. Installing NLTK
1 min read
How to Install PIL on Linux?
PIL is an acronym for Python Image Library. It is also called Pillow. It is one of the most famous libraries for manipulating images using the python programming language. It is a free and open-source Python library. Installing PIL on Linux:Method 1: Using PIP command: Step 1: Open up the Linux term
1 min read
How to Install Tor on Linux?
Tor browser is a web browser that is designed and developed to protect your privacy online and is mostly famous among normal people as a key for safely accessing hidden or restricted online resources, including those on the dark web. We will see what Tor is and how to install it on your Linux machin
5 min read
How to Install Pillow on Linux?
In this article, we will look into the various methods of installing the PIL package on a Linux machine. Python Imaging Library (expansion of PIL) is the de facto image processing package for Python language. It incorporates lightweight image processing tools that aid in editing, creating, and savin
2 min read
How to Install NuPIC on MacOS?
NuPIC stands for Numenta Platform for Intelligent Computing is a platform that implements the HTM (Hypertext Markup Language) learning algorithm. HTM is a detailed computational theory of the neocortex. At the core of HTM are timeframe continuous learning algorithms.NuPIC is used for a variety of pr
1 min read
How to Install Matplotlib on Linux?
Matplotlib is a low-level library of Python which is used for data visualization. It is easy to use and emulates MATLAB like graphs and visualization. This library is built on the top of NumPy arrays and consist of several plots like line chart, bar chart, histogram, etc. It provides a lot of flexib
2 min read