Posts

Showing posts with the label Machine Learning

Insight into Machine Learning: Powers and Pitfalls

Image
Since completing the Microsoft Professional Program in Data Science ( https://academy.microsoft.com/en-us/professional-program/tracks/data-science/ ) almost 2 years ago, I have been keeping a close eye on Machine Learning and Data Science trends. I learned many valuable insights about Machine Learning from this program. While working on a simple Tensorflow example recently I had an experience that perfectly illustrates one of these insights that I'm here to share today. Powers Here is a Git repository ( https://github.com/ActiveState/tensorflask ). In it contains the distillation of the work of an individual or group that took the time to train a Tensorflow model to categorize dogs. By downloading this code you harness the results of many hours of work that people have done.  The work includes curating thousands of sample photos of each type of dog, getting it into the correct format, and then training and tweaking the neural network to establish a very accurate tool ...

How to Setup TensorFlow GPU for accelerated Machine Learning and Cloud Portability

Image
Setting up TensorFlow is as simple as issuing: pip3 install tensorflow . This setup only uses your CPU to perform the calculations. To enable GPU support requires installing Nvidia drivers, CUDA toolkit, and cuDNN libraries and potential of spending hours troubleshooting installation dependencies. But as Andriy Lazorenko demonstrates with a common laptop setup  using a low-end Geforce MX945 GPU can provide three times the performance over the Intel Core i7 7500U CPU. If you have access to higher end GPUs you can realistically get 15x or more performance gains. That's the difference between waiting for an hour, or under 4 minutes to complete the same task! While it's possible to install everything locally on your computer . I recommend using Docker and building a container for each Tensorflow project you create for these reasons: 1) Cloud Portability Ready Ultimately, there may come a time that you will need more powerful hardware. Working with Docker co...

How To Install Nvidia CUDA 9.0 Toolkit on Ubuntu 18.04

Image
If the purpose of installing the CUDA toolkit 9.0 on Ubuntu 18.04 is purely to use tensorflow - gpu , I strongly advise you to use the Docker method documented here , as you get better hardware and code isolation and easy portability to the cloud later. TensorFlow Docker Installation  incorrectly indicates that the host machine needs the CUDA toolkit and cuDNN libraries to be installed on the host machine. This is not true. I have reached out Tensorflow community to correct this. How To If you need to install CUDA 9.0 toolkit on Ubuntu 18.04, here are the instructions. Uninstall Nvidia Drivers Uninstall any Nvidia drivers. To uninstall do: sudo apt-get remove --purge nvidia-* sudo apt-get remove --purge libnvidia-* This will avoid any versioning conflicts. CUDA Toolkit 9.0 and 9.1 requires nvidia-390_390.30 drivers.  Install CUDA Toolkit 9.0 (using Ubuntu 17.04 repository meta-data) The CUDA Toolkit is available at  https://developer.nvidia.com/cuda...

Failed CUDA Toolkit Install? Ubuntu 18.04 stuck on boot of Gnome Display Manager?

Image
I have been attempting to get TensorFlow GPU running on Ubuntu 18.04. The system requirements are simple:  TensorFlow GPU NVIDIA requirements . But I discovered the CUDA toolkit can result in some messy installation dependencies on specific versions of the Nvidia drivers leaving you with failed package installations such as: Errors were encountered while processing: /tmp/apt-dpkg-install-5dMwo8/100-nvidia-390_390.30-0ubuntu1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) What's worse if you reboot your computer you are met with a computer that is stuck booting, the system not able to progress past loading the Gnome Display Manager. Is my computer completely messed up? If you are stuck at boot up sequence access a tty terminal by pressing  ctrl + alt + F2 . You will be prompted to login in. Do it. Next, type: sudo apt-get install -f The system will list dependencies that were not installed correctly. In my case, my installed ...

Python Pandas: Replacement method for convert_objects()

Image
The  DataFrames.convert_objects()  in Pandas is a very useful function to try to infer better data types for you imported data. For example if you have just imported hockey player stats and the data looks like: df.dtypes Out[1]:  PLAYER    object TEAM      object GP        object G         object A         object PTS       object +/-       object dtype: object Using convert_objects: df.convert_objects(convert_numeric=True).dtypes  __main__:1: FutureWarning: convert_objects is deprecated.  Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. Out[2]:  PLAYER     object TEAM       object GP          int64 G           int64 A           int64 PTS     ...