Networking, Security & Cloud Knowledge

Friday, December 25, 2020

 Machine Learning

24 December 2020    


Introduction:

Machine Learning: It part of computer science that gives computer to learn without being explicitly programmed. Process is same as how human learn and then use his knowledge in day to day work and inventing new things. Process allow machine to learn form historical data and predict something.



ML Application:

·        E-commerce or entertainment site for predicting / recommending customers. E.g Netflix and Amazon can predict what their customer need and also recommend their customers.

·        Build good decision-making tree or algorithm / application.

·        Healthcare industry: to predict future health condition or develop medicine or treatment for particular health issue.

 


Statistical modeling used for ML

·     Popular arithmetical algorithms: Regression, Classification, and Clustering
·     Recommender Systems: Content-Based and Collaborative Filtering
·      Popular models: Train/Test Split, Gradient Descent, and Mean Squared Error

 


ML techniques:

·      Regression / estimation technique: used to predict continuous value.
·         Classification technique – used for predicting class or category of a cases.
·         Clustering – grouping of similar cases.
·         Association technique -used to find events or items that often co-occur.
·         Anomaly detection – discover abnormal or unusual case or behavior.
·         Sequence mining – used to predict next event.
·         Dimension reduction – used to reduce size of data
·         Recommendation system -recommend customer for particular product or item.
 

 

 

Difference between AI / ML / DL

  • AI(Artificial Intelligence)- make computer intelligent to perform function normally done by human. AI includes Computer Vision, Language Processing, Creative and summarization.
  • ML(Machine Learning)- is branch of AI that works with statistical part of AI. It helps computer to solve problem.
  • DL(Deep Learning)- this is enhancement of ML where computer learn and make decision.
  • DS: Data Science



 

Objective of Machine Learning (ML):

In machine learning we create models, that can be used for predication or processing.

 

IBM cognitiveclass.ai/ courses recommends:

·         Python packages, Numpy, SciPy, Matplotlib, Pandas Library and Scikit-learn

 

 

Open Source AI using Scikit-learn: (Source- IBM Cognitive Class)

·         It is a free ML library for the Python programming language.

·         It has built in algorithm or ML techniques.

·         Has good documentation and used with few line of python code.

·         Most task required for ML are implemented already in Sci-kit learn. So easy to implement.

 

 

How to use Scikit-learn:

·         It uses standardized data set, we can take any non-standard data and fix them.

·         You have to split your dataset into train and test sets to train your model. And then test the model’s accuracy separately

·         Normal recommendation

o   70 – 80 % data used as Train Set

o   10 – 20 % validation Set

o   10 – 20 % Test set

·         We setup algorithm and train your model with the train set. Outcome is to get unknow value.

·         We can use different metrics to evaluate your model accuracy.

·         Finally save your model.

 

The Microsoft Cloud-powered AI Platform:

·         Azure AI Services:           

o   Cognitive Services (Pre-built AI)

o   Azure ML services (Custom AI)

o   Bot Services (Conversation AI)

·         Azure Infrastructure:

o   Database, CPU, GPU etc.

·         Tools:

o   Coding & Management Tools:

§  Azure ML for VS code

§  Drag & Drop Designer

§  Automated ML

o   Deep Learning Frameworks

§  Cognitive toolkit

§  Tensor Flow

§  Caffe

Microsoft Pre-Built AI Services.

·         Vision : API for gesture

o   Computer Vision

o   Ink Recognizer

o   Face

o   Video Indexer

o   Custom Vision

o   Form Recognizer

·         Speech

o   Speech Translation

o   Speaker Recognition

o   Speech to Text

o   Text to Speech

·         Language

o   Immersive Reader

o   Translator text

o   Language understanding

o   Text Analytics

·         Search

·         Decision

 

We can download Intelligent Kiosk from Microsoft Store

Azure portal: portal.azure.com/#home

 

 

Type of learning model:

  •  Supervised:
  • Unsupervised
  • Semi-Supervised


Supervised

we teach mode or load model with knowledge so that we can have it predict future instance. We teach model by using some data from labeled dataset.

 

Sample: Labeled Data



 

 










Type of supervised learning:

  • Classification: it is process of predicting a discrete class label or category

                Decision Trees:

                    Two-Class Classification. Example True / False, Yes / No

                    Multi-Class Classification

  • Regression: is the process of predicting a continuous value.

 



Regression Wiki:

In statistical modeling, regression analysis is a set of statistical processes for estimating the relationships between a dependent variable (often called the 'outcome variable') and one or more independent variables (often called 'predictors', 'covariates', or 'features').

 

The most common form of regression analysis is linear regression, in which a researcher finds the line (or a more complex linear combination) that most closely fits the data according to a specific mathematical criterion.


 

Unsupervised Learning:

We don’t provide training to model but allow model to learn or discover of its own. It can work on unlabeled data.  It is using more complicated algorithm then supervised learning.

 

Technique used by unsupervised learning.

·         Dimension reduction
·         Density estimation
·         Market basket analysis
·         Clustering
                     K Means

 

Challenges and Risks Bias can affect result(Source Microsoft AI classroom course)
·         Errors may cause harms
·         Data could be exposed
·         Solution may not work for everyone
·         User must trust a complex system
·         Who’s liable for AI Driven Decisions


Principles of Responsible AI (Source Microsoft AI classroom course)
·         Fairness
·         Reliability and safety
·         Privacy and security
·         Inclusiveness
·         Transparency
·         Accountability
 

Tuesday, June 2, 2020

Cisco DevNet



Software development methodology:
Waterfall / Agile / Lean


1: Waterfall Methodology:

  • It is a linear project management approach, where customer requirements are gathered at the beginning of the project, and then a sequential project plan is created to accommodate those requirements.
  • {Requirements -- Design -- Implementation -- Verification --- Final Release -- Customer Feedback }
2: Agile Methodology:
  • Here there is continuous iteration of development and testing throughout the software development lifecycle of the project

  • {Requirements -- Design -- Implementation -- Verification --- Intermittent Release -- Customer Feedback } Cycle repeat multiple time till project end.

3: Lean Methodology:
  • It’s like updated version of Agile by promoting the flow of value to the customer through two pillar: continuous improvement and respect for people.

  • {Requirements -- Design -- Implementation -- Verification --- Intermittent Release -- Customer Feedback -- Continuous service improvement } Cycle repeat multiple time till project end.





Software Architecture design pattern.

What is MVC ?
Model View Controller
  • MVC is one of the most frequently used software architecture design pattern.
  • It separates application functionality and promotes organized programming.
Role:
  • Controller : Handles request flow only
  • Model : handles data logic, interact with database
  • View : handles data presentation


Flow
1: Client send Request to Controller
2: Controller communicate with model get data from model,
3: Controller communicate with View to get presentation
4: controller send respond to client




GIT: (Version control system)
It is repository that provides Distributed Version Control System (DVCS) for tracking changes in computer files.

It helps to co-ordinate work between multiple developer

Benefit of Git.

  • keeps track of code history
  • takes snapshots of files so that we can revert back at any time
  • We can stage file before committing

Installing GIT

  • Debian Linux : $ sudo apt-get install git
  • Fedora Linux : sudo yum install git
  • For Mac and Window : download from http://git-sc.com/download

Basic Git commnads

$ git init // initialize local git repository

$ git add // add files to index

$ git status // check status of working tree

$ git comit // comit changes in index

$ git push // push to remote repository

$ git pull // Pull latest from remote repository

$ git clone // clone repository into a new directory

$ git --version // shows git version
 
 



SCM
Software configuration management

Source code management
Updating In-progress: #############


Hypervisors:

  • VMware vSphere : all component  together  makes VMware's enterprise virtualization platform
  • VMware hypervisor / ESXi 5 - Hypervisor Operating System that run on the physical server. This is basic package which is installed on hardware and make possible virtualization.
  • ESXI is also called as host
What is hypervisor ?
A software layer or OS which presents hardware to the Guest OS.

Types of hypervisor

  • Type 1 : bare Metal : in this case hypervisor run directly on hardware
  • Type 2 "hosted": in this case hypervisor runs as application service on top of traditional OS, hardware is presented by host OS (window or Linux)


VMware ESX 3.5 boots red hat and then hypervisor
ESXi - things are changed
***************************************

Virtual machine : a container which is capable of installing and or running an operating system

*****************************************************

Guest : an OS running on a hypervisor within a Virtual Machine container

***************************************
Cos : console OS which is responsible for providing a user interface on the server itself

Cos in window is shell called explore.exe and in Linux it is bash


vCenter 5 - Service that Manges ESXi host (vcenter server is services runs on server end)

vSphere client - client to connect and configure vcenter and ESXI hosts.


Running desktop os on VM is expensive so we have

other comment :
vSphere desktop and VMware View (low license cost vm to host desktop os)
VMWare workstation ( run VM on desktop)

Other vendor
Citrix : Citrix XenServer
Microsoft Hyper -V



What is Docker ?


Normal application development process.
Developer develop application > send for testing > operation team install it on Server.

While developing we require framework, dependence or libraries when software is sent for testing, testing machine may not have similar framework, dependence or libraries. So, it might lead to failed while testing.


One of solution is to use Hypervisor, so now development team will not only send software for testing, but they will send image (Guest os + software) to tester. But this will create problem while sending it to operation team, operation team now will have to use one image for each software this will cause wastage of resources and license.

Now if we use docker which create container, we have advantage it can work like client, it can work as server or it can be shared socially.  

What is a Docker Container?
A Docker container is an open source software development platform. Its main advantage is to package applications in containers, allowing them to be portable to any system running a any operating system. A Windows machine can run Linux containers by using a virtual machine (VM). Docker is only one form of container technology.

Docker Containers:
It is  virtualization techn. VMs, also just one form of virtualization, allow a piece of hardware to host multiple operating systems as software. VMs are added to the host machine so that the hardware power can be shared among different users and appear as separate servers or machines. Containers virtualize the OS, splitting it into virtualized compartments to run container applications.

The Docker daemon does the assembling and running of code as well as the distribution of the finalized containers. It takes the commands from developer  and enters into the Docker client terminal and executes them.

This allows pieces of code to be put into smaller, easily transportable pieces that can run anywhere Linux or Windows is running. This way we make applications more distributed, and strip them down into specific functions.



Automation of software delivery using CI / CD


Earline we were using Waterfall model: client request for project, team work on project and after project is completed it was delivered to client.
To make think better we are now we are using Agile: we give client part /pipe of product 2-3 week and ask for feedback.
If project is divided into multiple module and developed by multiple developer.

All developer will test their module, but since all this module work together, we need integration testing.
All developer needs to integrating testing, if we get problem during testing, we have CI continuous integration.
Every day or every time developer will commit and tested using CI.

So, moment we done code and working in unit test we commit it so that integration test can be done.
2nd part is CD (continuous deliver and continuous deployment)
In continuous deliver we show demo of project to client on Mock Server.

So, in integration is we are pushing code for integration testing and delivery we are making it available for deployment

What is continuous deployment?
Her we directly deploy project without deliver, here there is risk if something goes wrong. 


Data Formats and Data Models

Like network device required protocol to communicate among themselves, application too need agree on some standard data format  and structure to exchange data among them

A data model is an abstract model that organizes elements of data and standardizes how they relate to one another and to the properties of real-world entities. (As per Wikipedia)
    Example: JSON, XML
A data format is the arrangement of data fields for a specific shape
    Example: YANG
Data models define how the data stored in a particular data format is structured.



Following example represent temperature and humidity of city in country:

1: Using XML Format:
         




2: Using JSON (Java Script Object Notation)
Jason data is written as key value pair separated by colon, here temp and humidity are keys and 37 and 40 are corresponding values. Each data is separated by coma accept last one and enclosed in curly braces. Key string has double quote, for value if its number no double quote is used.
{
“country”;
{“city”;
{
  ”temp”:37,
  ”humidity”:40
}
}
}
      

YAML

  • YAML is data serialization language used to store information about different object
  • We can use yaml to define key value pair, variable  list and object
  • It is similar to JASON.  It uses file extension .yml and .yaml 
  • For comment we use #
Example define information about person
Person:
Name: “Rama”
Occupations: “Developer”
Age: 30
Fav_num: 2e+10
Male: Ture
Birthday: 1990-01-01 14:40:22   iso 8601
Flaw: null

Indentation is important
To access value use person.name
Apart from key value object we can also define list
Hobbies:
  -hiking
  - Movies
  - riding bike

Another way to define list
Movies: [“oh my god”, “goal”]
Defining object

Friends:
-name: “Hanuman”
              - Age:30

Another way to define list

-{name:”Bharat”,age:22}

  
Another way to define list
Name: ”Laxman”
Age:23

Storing large about of data : E.G description
Description:
Hi this program
Is to learn in yaml


Description :>          # >  make store data in single line

Signature: |              # | ask yaml to preserve
Abcd
Xyz  inc
Email – abcd@xyz.com


Anchor data in YAML, image we want to create another variable id and this should be same as name
Name: &name “Mike”               # if we change name id will also change
Id:*name

Anchor key value pair
Base:& base
      Var1: value 1

Foo:
<<: base="" nbsp="" o:p="" var1:value1="">

Different data type converted to other type

Age:!!float 23    # covert 23 to s3.0
Gpa:!!str 3.5    # will change #3.5 to “3.5”
    



REST API
What is API ?
Application Programming Interface, which allow one piece of software talk to another.
There are different types of API, One of them is REST API.
REST: REpresentational State Transfer

REST work same like http

REST give states of an object,
e.g. we can send request to get temperature and humidity of specific location / place.
Here place is object and temperature and humidity data is state.

Soap is legacy method , now everyone uses REST



Rest call flow:
Client  à http call to à Server

CRUD : Four basic functions of  persistent storage.
  1. Create
  2. Read
  3. Update
  4. Delete

Corresponding http method
Create   ---    Post
Read     ---    Get
Update  ---    Put
Delete   ---    Delete

We get response back with Java script object notation (JASON) formatted data, it is structured data with key value pair.

We can get data in XML or JASON

HTTP Request methods
GET – get data from API
POST – Post data in body of request
 Difference between REST and SOAP

               REST                                                                          SOAP
Representational State Transfer                              Simple object access protocol
Communicate over http uses http verbs                  Communicate over http, smtp, tcp, udp
Return data in different format as per request        Uses XML for its message format.

Rest request uses URI

REST Code:
200    OK
400    Invalid Request
401    Authentication failure
403    Access is not allowed
500    Something went wrong on the server
503    Server is overloaded

One of REST client is POSTMAN

Postman

It is API Client, it help to develop, test, share and documents APIs

Postman is the only complete API development environment. The comprehensive set of built-in tools support every stage of the API lifecycle so individuals and teams can easily maintain a single source of truth. You can design and mock, debug, test, document, monitor, and publish your APIs from the Postman UI.

https://getpostman.com

NETCONF:
We can configure router using different method
·       cli (using telent / ssh)
·       SNMP (using NMS )
·       NETCONF (NETworkCONFiguration)
 Why we need netconf?
Using traditional CLI config we need to enter command per line on each device for doing network changes. SNMP option can automate it but its not scalable.
In today’s network we want to have application with deeper integration with network and DEVOPS allowed develop and deliver software to network devices not just by network engineer but also Developers.
Benefit  / Feature of Netconf:
·       Allows to configure network device using program instead of cli and enter individual command.
·       It is IETF standard introduced in 2006
·       Intent based networking: Netconf is not vendor dependent,  work with multiple vendor.
Netconf component :
Like client-server architecture where have Client requesting data from server. Netconf we have Manager and Agent.
·       Manager (may have some application e.g python app) 
·       Agent (network devise such as switch or router)

It uses YANG data model, yang data is encoded in XML format and transported using netconf.
              {Netconf[XML(YANG DATA)]}
Netconf uses secure shell, we have utility like ncclient
Yang (Yet Another Next Generation):
  • Yang data model are created by different vendor, it may be by IETF or Hardware Vendor.
  • Module name in yang data tell who created module
  • Yang data model of a network interface: module  à container à list
  • Yang was standardized in 2010,
Netconf use xml data format to encapsulate YANG data


Overview of Cisco Tool for Network Automation:

DNA (Digital Network Architecture) Solution:
  • DNA Center (is controller for DNA)
  • SD-WAN or enterprise network or campus use
  • DNA-Center is evaluation of EPIC-EM
  • One of component of DAN center is Assurance. Which check health of the network.
  • Data plan don't go through controller. Only management   / reporting plane is moved to controller. Routing and forwarding decision is taken at network edge level.
  • Southbound in DNA center has devices which DNA center manages. CLI, NETCONF,  RESTAPI. Northbound it connect to thing which manages DNA, e.g. RESTAPI

ACI (Application Centric Infrastructure:
  • ACI solution is designed for  DC environment. 
  • In DC we need high speed connectivity like 10 Gig / 40 Gig or may be 100 Gig in future. To support this we use Nexus switch.
  • We can say Nexus switch = High speed LAN switch + FC SAN Switch
  • To manage DC Nexus switch we can use ACI. We also open source controller to manage nexus instead of ACI.
  • PUPET open DEVOPS configuration management tool. Used for Server and application component. Nexus product has agent for PUPET, CHEF etc.
NSO (network service orchestration ):
  • Originally  targeted for service provider to configure large scale environment. It's not controller like ACI or SDN  but it is used as configuration management tool.