Machine Learning with Swift
eBook - ePub

Machine Learning with Swift

Alexander Sosnovshchenko

Condividi libro
  1. English
  2. ePUB (disponibile sull'app)
  3. Disponibile su iOS e Android
eBook - ePub

Machine Learning with Swift

Alexander Sosnovshchenko

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Leverage the power of machine learning and Swift programming to build intelligent iOS applications with easeAbout This Book• Implement effective machine learning solutions for your iOS applications• Use Swift and Core ML to build and deploy popular machine learning models• Develop neural networks for natural language processing and computer visionWho This Book Is ForiOS developers who wish to create smarter iOS applications using the power of machine learning will find this book to be useful. This book will also benefit data science professionals who are interested in performing machine learning on mobile devices. Familiarity with Swift programming is all you need to get started with this book.What You Will Learn• Learn rapid model prototyping with Python and Swift• Deploy pre-trained models to iOS using Core ML• Find hidden patterns in the data using unsupervised learning• Get a deeper understanding of the clustering techniques• Learn modern compact architectures of neural networks for iOS devices• Train neural networks for image processing and natural language processingIn DetailMachine learning as a field promises to bring increased intelligence to the software by helping us learn and analyse information efficiently and discover certain patterns that humans cannot. This book will be your guide as you embark on an exciting journey in machine learning using the popular Swift language. We'll start with machine learning basics in the first part of the book to develop a lasting intuition about fundamental machine learning concepts. We explore various supervised and unsupervised statistical learning techniques and how to implement them in Swift, while the third section walks you through deep learning techniques with the help of typical real-world cases. In the last section, we will dive into some hard core topics such as model compression, GPU acceleration and provide some recommendations to avoid common mistakes during machine learning application development. By the end of the book, you'll be able to develop intelligent applications written in Swift that can learn for themselves.Style and approachA comprehensive guide that teaches how to implement machine learning apps for iOS from scratch

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Machine Learning with Swift è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Machine Learning with Swift di Alexander Sosnovshchenko in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Intelligenza artificiale (IA) e semantica. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781787123526

Classification – Decision Tree Learning

In the previous chapter, we discussed different types of machine learning, including supervised classification tasks; in this chapter, we will build our first Swift application for this. We will discuss main components of machine learning development stack, and will also exercise in data generation, exploratory analysis, preprocessing, and models training and evaluation in Python. After this, we will transfer our model to Swift. We will also discuss a specific class of supervised learning algorithms—decision tree learning and its extension: random forest.
The following topics are waiting for us in this chapter:
  • Machine learning software development stack
  • Python toolbox for machine learning: IPython, SciPy, scikit-learn
  • Dataset generation and exploratory analysis
  • Data preprocessing
  • Decision tree learning and random forest
  • Assessing the model performance using different performance metrics
  • Underfitting and overfitting
  • Exporting scikit-learn models to Core ML format
  • Deploying trained models to iOS

Machine learning toolbox

For many years, the programming language of choice for machine learning was one of the following: Python, R, MATLAB, C++. This is not due to some specific language features, but because of the infrastructure around it: libraries and tools. Swift is a relatively young programming language, and anyone who chooses it as a primary tool for machine learning development should start from the very basic building blocks, and build his own tools and libraries. Recently, Apple became more open to third-party Python machine learning tools: Core ML can work with some of them.
Here is a list of components that are needed for the successful machine learning research and development, and examples of popular libraries and tools of the type:
  • Linear algebra: Machine learning developer needs data structures like vectors, matrices, and tensors with compact syntax and hardware-accelerated operations on them. Examples in other languages: NumPy, MATLAB, and R standard libraries, Torch.
  • Probability theory: All kinds of random data generation: random numbers and collections of them; probability distributions; permutations; shuffling of collections, weighted sampling, and so on. Examples: NumPy, and R standard library.
  • Data input-output: In machine learning, we are usually most interested in the parsing and saving data in the following formats: plain text, tabular files like CSV, databases like SQL, internet formats JSON, XML, HTML, and web scraping. There are also a lot of domain-specific formats.
  • Data wrangling: Table-like data structures, data engineering tools: dataset cleaning, querying, splitting, merging, shuffling, and so on. Pandas, dplyr.
  • Data analysis/statistic: Descriptive statistic, hypotheses testing and all kinds of statistical stuff. R standard library, and a lot of CRAN packages.
  • Visualization: Statistical data visualization (not pie charts): graph visualization, histograms, mosaic plots, heat maps, dendrograms, 3D-surfaces, spatial and multidimensional data visualization, interactive visualization, Matplotlib, Seaborn, Bokeh, ggplot2, ggmap, Graphviz, D3.js.
  • Symbolic computations: Automatic differentiation: SymPy, Theano, Autograd.
  • Machine learning packages: Machine learning algorithms and solvers. Scikit-learn, Keras, XGBoost, E1071, and caret.
  • Interactive prototyping environment: Jupyter, R studio, MATLAB, and iTorch.
This is not referring to domain-specific tools, like NLP, or computer vision libraries.
As for summer 2017, I'm not aware of Swift alternatives of comparable quality and functionality to any of the mentioned tools. Also, none of these popular libraries are directly compatible with Swift, meaning you can't call Keras from your iOS Swift code. All this means that Swift cannot be the primary tool for machine learning research and development. Killing Python is not on Swift's agenda so far; however, to a different degree, there are some compatible libraries and tools, which using a wide scope of machine learning problems can be addressed in your Swift applications. In the following chapters, we're building our own tools, or introducing third-party tools as we need them. We are talking about machine learning libraries specifically in Chapter 10, Natural Language Processing. Still, for anyone who wants to work with machine learning, it's more than advisable to know well at least one from this list: Python, R, and MATLAB.

Prototyping the first machine learning app

Usually, before implementing a machine learning application for mobile devices, you want to do a quick and dirty prototype just to check your ideas. This allows to save a lot of time when you realize that the model you initially thought works perfectly for your problem, in reality doesn't. The quickest way to do a prototype is to use Python or R tools listed in the previous section.
Python is a general-purpose programming language with rich infrastructure and vibrant community. Its syntax is similar in many wa...

Indice dei contenuti