Posts

Machine Learning Tutorials

 Install anaconda https://www.anaconda.com/ Open the terminal: Hoomans-Mac-mini:~ hoomansalamat$ mkdir ML Hoomans-Mac-mini:~ hoomansalamat$ cd ML Hoomans-Mac-mini:ML hoomansalamat$ jupyter notebook Download Video Game Sales from https://www.kaggle.com/gregorut/videogamesales and unzip to ML directory ###############Import CSV file################# import pandas as pd df = pd.read_csv('vgsales.csv') df.shape df.describe() df.values ###############Predict################# Create a music.csv file: age gender genre 20 1 HipHop 23 1 HipHop 25 1 HipHop 26 1 Jazz 29 1 Jazz 30 1 Jazz 31 1 Classical 33 1 Classical 37 1 Classical 20 0 Dance 21 0 Dance 25 0 Dance 26 0 Acoustic 27 0 Acoustic 30 0 Acoustic 31 0 Classical 34 0 Classical 35 0 Classical Let's create a model that predicts a music genre based on age and gender of people.  import pandas as pd from sklearn.tree import DecisionTreeClassifier music_dat...

How to program CUDA with Python

#An introduction to CUDA in Python #Coding directly in Python functions that will be executed on GPU may allow # to remove bottlenecks while keeping the code short and simple. In this introduction, # we show one way to use CUDA in Python, and explain some basic principles of CUDA programming. #We choose to use the Open Source package Numba. # Numba is a just-in-time compiler for Python that allows in particular to write CUDA kernels. # Numba is freely available at https://github.com/numba/numba. #Note that there are other packages, such as PyCUDA, that also allow to launch CUDA kernels in Python. #Preliminary #Let’s define first some vocabulary: #a CUDA kernel is a function that is executed on the GPU, #the GPU and its memory are called the device, #the CPU and its memory are called the host. #Now let’s check the versions used in this notebook: import sys import numba import numpy print ( "Python version:" , sys.version) print ( "Numba version:" , numba. __version__...

How to Import a packgae in PyCharm?

  First of all import the pacakage of pip in python console. import pip The below command will upgrade the version of package setuptools. pip.main([ 'install' , '--upgrade' , 'setuptools' ]) The below command will install the scikit-learn and numpy packages. pip.main([ 'install' , 'numpy' , 'scikit-learn' ]) How to Import CX_Oracle in PyCharm? Open PyCharm and then Open your project. Click on the menu  File > Settings  and then the Settings window will open. In the Settings window, click on the  Project  node to expand and then click on the  Project Interpreter . Then on the right side, click on the  +  button to open  Available Packages  window, as shown in below image. Then search for  cx_Oracle  in the search box. Below you will find the cx_Oracle package. Click on it to select and then click on the  Install Package  button as shown below. import cx_Oracle connection = cx_Oracle . connect ( "scott" , "tige...