Why believe the machines ?
Posted by
Manish Panchmatia
on Sunday, April 22, 2018
Labels:
ArtificialIntelligence,
MachineLearning,
Meetup
/
Comments: (1)
Full article...>>
We trust God, Men and Machine should bring data.
Sometimes statistics can be another way to tell lie. Look at this example: Death rate is low among group of solders compare to city population. It does not mean, all should join military for having longer life. Solders are healthy young population, while city population includes all age group and all health condition people.
Does machine lies?
Machine does not lie on its own. However, one makes machine to lie us unconsciously by
Importance of accuracy
We does not care about incorrectness by machine learning algorithm for image recognition, recommendation system, super accurate OCRs etc.
However, all people are sensitive to incorrectness by machine learning algorithms at medical diagnostics, financial fraud detection, autonomous car.
Explain
So machine learning algorithms should also explain the rational behind proposed solution/answer, same like human beings. Google map already explains rational behind best suggested route, with traffic jam indications.
The benefits of such explanations are enormous. At some of the countries it is enforced by law, that machine learning algorithms must provide rational and justification. It provides more insight to the domain. So it helps:
However, it is computationally expensive. As an alternative "Locally Interpretative Surrogate Model" can be used, that closely mimic the actual model.
Reference:
A talk by Dr. Vikas Agrwal from "Oracle Analytics Cloud" on the topic "Why believe the machines ?". It was "Developer Connect" event on Machine Learning and Artificial Intelligence, at Bangalore India by NVIDIA. Please refer https://drive.google.com/drive/folders/1-er_ORBUGr37dmM2owujO821_l1BmwC9?usp=sharing Folder : DC_Bangalore 5th Video "Dr. Vikas Agrwal.mp4" from 3:05 to 48:40
Note:
This blog post is not verbatim of Dr. Vijas's speech. The text describe above is as per my own understanding of discussion at the venue, that may not be fully correct. Any comments, suggestions, additions, modifications, corrections are welcome.
Sometimes statistics can be another way to tell lie. Look at this example: Death rate is low among group of solders compare to city population. It does not mean, all should join military for having longer life. Solders are healthy young population, while city population includes all age group and all health condition people.
Does machine lies?
Machine does not lie on its own. However, one makes machine to lie us unconsciously by
- Accepting poorly-specified models
- Improperly combining different generes of models
- Using biased data
Such models work very well on training data and test data with respect to certain metrics. So people believe those models.
Importance of accuracy
We does not care about incorrectness by machine learning algorithm for image recognition, recommendation system, super accurate OCRs etc.
However, all people are sensitive to incorrectness by machine learning algorithms at medical diagnostics, financial fraud detection, autonomous car.
Explain
So machine learning algorithms should also explain the rational behind proposed solution/answer, same like human beings. Google map already explains rational behind best suggested route, with traffic jam indications.
The benefits of such explanations are enormous. At some of the countries it is enforced by law, that machine learning algorithms must provide rational and justification. It provides more insight to the domain. So it helps:
- To detect unconscious bias in data and incorrect logic. For example: one image recognition algorithm incorrectly classified the image based on background.
- To provide gut feeling and intuitive sense of data
- To learn : novel mechanism, cause of effects, better processes to solve the problem. For example: (1) Doctor job is easier, if machine learning algorithm explains the rational along with diagnostics and recommendations (2) Player can learn how to play Alpha-go game in better way, if the algorithm explains the move.
- People trust more the model
- Humans and machine can work as a team
Machine Learning Algorithm Classifications
Now let's classify the machine learning algorithms as per their capability to provide the explanation.
- White box algorithms with high interpretablity and low accuracy. Examples: Regression, Decision Tree, Association Rule Mining, Linear SVMs
- Grey box algorithms. Examplaes: Clustering, Bayesian Nets, Genetics algorithms, Logic programming
- Black Box algorithms. Examples : DNN, Non-linear matrix factorisation, non-linear dimensionality reduction
Implementation
Layer wise Relevance Propagation (LRP) is useful technique for DNN to get more insight. In this technique backward propagation is used to highlight, which neuron is contributing to final output. At the end it highlight the input features who are contributing more to the final decision.
However, it is computationally expensive. As an alternative "Locally Interpretative Surrogate Model" can be used, that closely mimic the actual model.
Reference:
A talk by Dr. Vikas Agrwal from "Oracle Analytics Cloud" on the topic "Why believe the machines ?". It was "Developer Connect" event on Machine Learning and Artificial Intelligence, at Bangalore India by NVIDIA. Please refer https://drive.google.com/drive/folders/1-er_ORBUGr37dmM2owujO821_l1BmwC9?usp=sharing Folder : DC_Bangalore 5th Video "Dr. Vikas Agrwal.mp4" from 3:05 to 48:40
Note:
This blog post is not verbatim of Dr. Vijas's speech. The text describe above is as per my own understanding of discussion at the venue, that may not be fully correct. Any comments, suggestions, additions, modifications, corrections are welcome.
My Python Notes
Posted by
Manish Panchmatia
on Sunday, March 25, 2018
Labels:
Python,
software
/
Comments: (2)
Full article...>>
Everything is object, including class
Everything has namespace
Everything can be printed / retrospected
Functions are first class object
- They can be passed as arguments to other functions,
- returned as values from other functions, and
- assigned to variables and stored in data structures.
In Python values carries types
In Python variables do not carry types
Variables means reference to object
Always object reference is passed to function
PyPy : Run time environment
Python supports
* Multiple inheritence
* mixins
* extensive introspection of type and class
* operator overloading with special member function
* complex numbers
* limited support to lambda
Modules
Module = Statements + Definitions
Few important modules are:
OS : System calls. enviorn for env variables like $HOME. it is dictionary.
sys : to get argv. e.g. sys.argv[1:] because argv[0] is programe name
string, regex, collections, heapq, array, enum, etc.
numbers, decimals and fractions : For extra numeric types
Package
__init__.py is default constructor for the package.
from package import module
Package is a folder, that contains (1) __init__.py file (2) 1+ .py files as modules. (3) optionally contains another folder as package.
Type conversion:
Moderatly type checked language
Implicit conversion for numeric types
No implicit conversion between string and number
Switch = if ... elif ... elif ... else
* Base Types
String is immutable. So replacing a char, returns new String object.
* Collection (container) Types
Objects can be easily refernced or indexed
A. Sequence : ordered type
1. String = immutable
String Format
print("I just printed %s pages to the printer %s" % (num, printer))
print("I just printed {0} pages to the printer {1}".format(num, printer))
print("I just printed {num} pages to the printer {printer}".format(num=num, printer=printer))
print(f"I just printed {num} pages to the printer {printer}")
""" OR ''' are used for multiline string
space, coma and newline are default delimiter used in split
x = input("Prompt message"). here x will be always string.
2. Lists = mutable, dynamic array.
List has in-build functions like : sort, len, append(one member), remove (value is argument), To delete entry from list at specific index, use : "del list[index]". insert, extend (list), index, pop = pop(-1) (index is argument), no push function.
List declaration: a_list = [1, 2, "asdf"] OR a_list = list()
comprehension is like lembda function.
primes = [2]
e.g. list2 = [x ** 2 for x in list1]
Here primes is list with member 2
By Reference
L1 = [1, 2, 3]
L2 = L1
To make duplicate copy of list
L2 = L1[:]
3. Tuples = immutable.
Tuple declaration: a_tuple = 1, 2, "asdf" OR a_tuple = (1, 2, "asdf")
Tuples are also good for storing closely related data. For example, (x, y, z) coordinates or (r, g, b) colour components. Tuples are records without field name. So order of values and number of fields are very important. It is like ASN.1 encoded byte stream. The actual variable name is defined somewhere in RFC. So number of field and sequence of values are very important.
B. Mapping : un-ordered type
1. Dictionaries = Associative Array. Keys are immutable. So String and Tuples can be keys.
Dictionary declaration: dict = {k1:v1, k2:v2}
Useful for JSON objects.
Dictionary has built-in functions like : has_key(key), get(key, 'optional unknown'), keys, values, del dict['key'], update function will merge the value part: if key found then change value else add the pair. Two dictionary can be merged with update, for duplicate key
one can get list containing keys from dictionary. a_list = list(a_dict)
Here, list create an empty list.
if name key is added to first time, then it will be added with value as empty list []
2. Set : no duplicate. no order,
Set declaration : a_set = {0, (), "asdf", False}
Set has built-in functions like : union |, intersection &, difference, symmetric difference -, union - intersection = ^, and subset testing
x = {} This is empty dic not empty set.
3. Frozenset : immutable set
To iterate through all collection, one can use:
for item in
The built-in function type() allows us to obtain the type of any object.
Python code compilation to :
1. CPython : code -> Python byte code
2. Jython : code -> Java Byte Code
3. IronPython : code -> IL(.NET) Byte code
Variable scope
1. local scope
2. global scope
3. built-in scope
Comparison
* string, number, sequence, map all can be compared
* a < b < c = (a < b) && (b < c)
The core built-in types for manipulating binary data are bytes and bytearray. They are supported by memoryview, which uses the buffer protocol to access the memory of other binary objects without needing to make a copy.
To activate any virtual enviornment
source venv/bin/activate
It can be created with below steps
pip install virtualenv
sudo /usr/bin/easy_install virtualenv
cd robot-tests
virtualenv venv
source ./venv/bin/activate
pip install
deactivate
Reference:
https://devopedia.org/python-data-structures
inside class, function is called "class method"
inside class, variable is called "member variable"
"this" in Java, is "self" in Python. "self" can be replaced with another name. it should be first argument. Inside method, object variables can be accessed using self
One more method type, where we pass cls. Here with cls, we can access class member.
__init__ is constructor
__del__ is destructor
If we have two __init__ function in the class. Then last one will override all earlier __init__ functions.
For inheritance, parent class is passed as input. Obejct is parent class of all.
At abstract class add @abstractmethod decorator,
Abstract class should be child of ABC
private member start with __
To build iterator class, we need two methods:
1. __iter__
2. next
in addition to __init__
Generator is just a function. Not Class. It should have yield statement. It returns the iterator object.
lambda is a one line nameless/anonymous function in python
It is used in map, filter, list comprehension etc.
map (function, iterable)
map is a special function.
it returns iterable
The first argument 'function' can be lambda or any other built-in function name like 'str'
filter function. input is predicate. predicate is a condition check.
itertools module has map, filter, accumulation, count, repeat, permutation, products etc.
decorator
@class it replace the constructor.
@property
we can have custom decorator as method
list comprehension
If 2 functions calls each other recursively then also it is recursive function
raise is to stop programme, when error happens
print("%r") can be used, when we are not sure about integer, or string.
Recommendations
Everything has namespace
Everything can be printed / retrospected
Functions are first class object
- They can be passed as arguments to other functions,
- returned as values from other functions, and
- assigned to variables and stored in data structures.
In Python values carries types
In Python variables do not carry types
Variables means reference to object
Always object reference is passed to function
PyPy : Run time environment
Python supports
* Multiple inheritence
* mixins
* extensive introspection of type and class
* operator overloading with special member function
* complex numbers
* limited support to lambda
Modules
Module = Statements + Definitions
Few important modules are:
OS : System calls. enviorn for env variables like $HOME. it is dictionary.
sys : to get argv. e.g. sys.argv[1:] because argv[0] is programe name
string, regex, collections, heapq, array, enum, etc.
numbers, decimals and fractions : For extra numeric types
Package
__init__.py is default constructor for the package.
from package import module
Package is a folder, that contains (1) __init__.py file (2) 1+ .py files as modules. (3) optionally contains another folder as package.
Type conversion:
Moderatly type checked language
Implicit conversion for numeric types
No implicit conversion between string and number
Switch = if ... elif ... elif ... else
* Base Types
String is immutable. So replacing a char, returns new String object.
* Collection (container) Types
Objects can be easily refernced or indexed
A. Sequence : ordered type
1. String = immutable
String Format
print("I just printed %s pages to the printer %s" % (num, printer))
print("I just printed {0} pages to the printer {1}".format(num, printer))
print("I just printed {num} pages to the printer {printer}".format(num=num, printer=printer))
print(f"I just printed {num} pages to the printer {printer}")
""" OR ''' are used for multiline string
space, coma and newline are default delimiter used in split
x = input("Prompt message"). here x will be always string.
2. Lists = mutable, dynamic array.
List has in-build functions like : sort, len, append(one member), remove (value is argument), To delete entry from list at specific index, use : "del list[index]". insert, extend (list), index, pop = pop(-1) (index is argument), no push function.
List declaration: a_list = [1, 2, "asdf"] OR a_list = list()
comprehension is like lembda function.
primes = [2]
e.g. list2 = [x ** 2 for x in list1]
Here primes is list with member 2
By Reference
L1 = [1, 2, 3]
L2 = L1
To make duplicate copy of list
L2 = L1[:]
3. Tuples = immutable.
Tuple declaration: a_tuple = 1, 2, "asdf" OR a_tuple = (1, 2, "asdf")
Tuples are also good for storing closely related data. For example, (x, y, z) coordinates or (r, g, b) colour components. Tuples are records without field name. So order of values and number of fields are very important. It is like ASN.1 encoded byte stream. The actual variable name is defined somewhere in RFC. So number of field and sequence of values are very important.
B. Mapping : un-ordered type
1. Dictionaries = Associative Array. Keys are immutable. So String and Tuples can be keys.
Dictionary declaration: dict = {k1:v1, k2:v2}
Useful for JSON objects.
Dictionary has built-in functions like : has_key(key), get(key, 'optional unknown'), keys, values, del dict['key'], update function will merge the value part: if key found then change value else add the pair. Two dictionary can be merged with update, for duplicate key
>>> x = {'a': 1, 'b': 2}
>>> y = {'b': 3, 'c': 4}
>>> z = {**x, **y}
>>> z
{'c': 4, 'a': 1, 'b': 3}
one can get list containing keys from dictionary. a_list = list(a_dict)
.set_default() is also important function
defaultdict is function at collections module. It will set default value, when key is added for first time.
>>> student_grades = defaultdict(list)
>>> for name, grade in grades:
... student_grades[name].append(grade)
if name key is added to first time, then it will be added with value as empty list []
2. Set : no duplicate. no order,
Set declaration : a_set = {0, (), "asdf", False}
Set has built-in functions like : union |, intersection &, difference, symmetric difference -, union - intersection = ^, and subset testing
x = {} This is empty dic not empty set.
3. Frozenset : immutable set
To iterate through all collection, one can use:
for item in
The built-in function type() allows us to obtain the type of any object.
Python code compilation to :
1. CPython : code -> Python byte code
2. Jython : code -> Java Byte Code
3. IronPython : code -> IL(.NET) Byte code
Variable scope
1. local scope
2. global scope
3. built-in scope
Comparison
* string, number, sequence, map all can be compared
* a < b < c = (a < b) && (b < c)
The core built-in types for manipulating binary data are bytes and bytearray. They are supported by memoryview, which uses the buffer protocol to access the memory of other binary objects without needing to make a copy.
To activate any virtual enviornment
source venv/bin/activate
It can be created with below steps
pip install virtualenv
sudo /usr/bin/easy_install virtualenv
cd robot-tests
virtualenv venv
source ./venv/bin/activate
pip install
deactivate
Reference:
https://devopedia.org/python-data-structures
inside class, function is called "class method"
inside class, variable is called "member variable"
"this" in Java, is "self" in Python. "self" can be replaced with another name. it should be first argument. Inside method, object variables can be accessed using self
One more method type, where we pass cls. Here with cls, we can access class member.
__init__ is constructor
__del__ is destructor
If we have two __init__ function in the class. Then last one will override all earlier __init__ functions.
For inheritance, parent class is passed as input. Obejct is parent class of all.
At abstract class add @abstractmethod decorator,
Abstract class should be child of ABC
private member start with __
To build iterator class, we need two methods:
1. __iter__
2. next
in addition to __init__
Generator is just a function. Not Class. It should have yield statement. It returns the iterator object.
lambda is a one line nameless/anonymous function in python
It is used in map, filter, list comprehension etc.
map (function, iterable)
map is a special function.
it returns iterable
The first argument 'function' can be lambda or any other built-in function name like 'str'
filter function. input is predicate. predicate is a condition check.
itertools module has map, filter, accumulation, count, repeat, permutation, products etc.
decorator
@class it replace the constructor.
@property
we can have custom decorator as method
list comprehension
If 2 functions calls each other recursively then also it is recursive function
raise is to stop programme, when error happens
print("%r") can be used, when we are not sure about integer, or string.
Recommendations
- instead of "if condition" use dictionary
- instead of "loop" use "try catch"
- for re-usability, write code in class.
- add documentation
- Use _ for variables, you don’t care about. It is just a convention.
- The * operator allow us to capture remaining items after an unpacking into a list. For example
head, *middle, tail = number
Singleton design pattern
https://www.tutorialspoint.com/python_design_patterns/python_design_patterns_singleton.htm
https://www.xoolive.org/2016/06/29/python-private-constructor.html
https://stackoverflow.com/questions/8212053/private-constructor-in-python
https://stackoverflow.com/questions/25040834/prevent-other-classes-methods-from-calling-my-constructor/25041285
https://treyhunner.com/2018/03/tuple-unpacking-improves-python-code-readability/
https://github.com/satwikkansal/wtfpython
- Static variable in Python method https://code-maven.com/slides/python-programming/static-variable
- Python 2 variables can be swapped with this code
- Debugging in Python
1.
# Some complicated code with bugs- Counter from collections module is useful for word count. input is string. it crates dictionary of word as key and count as value.
- This common string group is also useful
string.ascii_lettersstring.ascii_uppercasestring.ascii_lowercasestring.digitsstring.hexdigitsstring.octdigitsstring.punctuationstring.printablestring.whitespace
Singleton design pattern
https://www.tutorialspoint.com/python_design_patterns/python_design_patterns_singleton.htm
https://www.xoolive.org/2016/06/29/python-private-constructor.html
https://stackoverflow.com/questions/8212053/private-constructor-in-python
https://stackoverflow.com/questions/25040834/prevent-other-classes-methods-from-calling-my-constructor/25041285
https://treyhunner.com/2018/03/tuple-unpacking-improves-python-code-readability/
https://github.com/satwikkansal/wtfpython
Cloud Native Landscape
Posted by
Manish Panchmatia
on Tuesday, February 27, 2018
Labels:
software
/
Comments: (0)
Full article...>>
5G NR : Part 1
Posted by
Manish Panchmatia
on Tuesday, January 16, 2018
Labels:
Education,
Innovation,
software,
Telecom Wireless
/
Comments: (0)
Full article...>>
5G is about IoT. In fact in 4G also, IoT related standardization was started with NB-IoT.
Use Cases
Use Cases
- AR/VR
- Autonomous transportation (car)
- Reliable access to remote health-care
- Public safety
- Smarter Agriculture
- Efficient use of energy/utilities
- Autonomous manufacturing
- Sustainable cities and infrastructure
- Digitized logistics and retails
Verticals
| Avalanche of traffic volume | Massive connected devices | Diversified use cases Autonomous car |
|---|---|---|
| Connectivity Req Peak data rate 10Gbps Min data rate 50 Mbps High user mobility Brodband access in dense area | Connectivity Req Low cost Low energy Low packet size | Connectivity Req Ultra high reliability Ultra low latency |
| Use cases Ultra large volume transfer Always connected in crowd AR / VR | Use Cases IoT IIoT | Use cases V2V communication Driver-less car Remote surgery Smart grid Manufacturing Robot |
Market Segments
1. Enhanced Mobile Broadband (eMBB)
2. Massive Machine Type Communications (eMTC)
3. Ultra Reliable and Low Latency Communications (URLLC)
Key KPIs
1. Peak data rate
2. Spectrum efficiency
3. Mobility
4. Latency
5. Connection diversity
6. Network energy efficiency
7. Area traffic capacity
5G standard bodies
1. 3GPP (ITU-R) : (IMT 2020)
2. EU - (METIS - 2020)
3.1 Japan 2020 and beyond
3.2 Korea 5G Forum
3.3 MOST - China
5G Evolution
1. IMT-Advanced
2. Enhanced IMT-Advanced
3. 5G RAN
Peak data rate
Mobility
Capacity (/km square)
Number of connected devices / cell
User plane latency
Energy Saving (energy / bit)
5G Standards
3GPP 5G NR Specification
|
Verizon 5G Specification
| |
|---|---|---|
| Phy channels and modulation | 38.211 : NR | TS V5G.211 |
| Multiplexing and channel coding | 38.212 : NR | TS V5G.212 |
| Physical layer procedures | 38.213 : NR | TS V5G.213 |
| URL | http://www.3gpp.org/DynaReport/38-series.htm | http://www.5gtf.net/ |
pre 5G standard - https://m.corp.kt.com/eng/html/biz/services/sig.html
3GPP Important Standards
TS 38.211 NR; Physical channels and modulation
TS 38.212 NR; Multiplexing and channel coding
TS 38.213 NR; Physical layer procedures for control
TS 38.214 NR; Physical layer procedures for data
TS 38.215 NR; Physical layer measurements
TS 38.300 NR; Overall description; Stage-2
TS 38.321 NR; Medium Access Control (MAC) protocol specification
TS 38.322 NR; Radio Link Control (RLC) protocol specification
TS 38.323 NR; Packet Data Convergence Protocol (PDCP) specification
TS 38.331 NR; Radio Resource Control (RRC); Protocol specification
TR 38.801 Study on new radio access technology: Radio access architecture and interfaces
TR 38.912 Study on new radio access technology
TR 38.913 Study on scenarios and requirements for next generation access technologies
TS 23.501 System Architecture for the 5G System
NSA
gNB to EPC
SA
gNB to 5G CN
For greenfield deployment
4G and 5G comparison
4G
|
5G
|
|---|---|
| eNB | gNB Key Functions: 1. Intercell Radio Resource Management 2. Resouce Block Control 3. Radio Admission Control 4. Connection Mobility Control 5. Dynamic Resource Allocation (Scheduler) 6. Measurement Configuration and Provisioning |
| X2 Interface | Xn Interface |
| MME | AMF : Access & Mobility Management F Key Functions: 1. NAS Security 2. Idle State Mobility Handling |
| S-GW | UPF : User Plane F Key Functions: 1. Mobility Anchroing 2. PDU Handling |
| P-GW | SMF : Session Management F Key Functions: 1. UE IP Address Allocation 2. PDU Session Control. |
| S1-C | NG-C |
| S1-U | NG-U |
| EPC | 5G CN = NGC |
U-Plane
New protocol SDAP over existing PDCP
Deployment Models
| Model | Fy | BW |
|---|---|---|
| Indoor Hotspot | 30 GHz | Upto 1 GHz |
| Rural | 700 MHz | Upto 20 MHz |
| High Speed | 4 GHz | Upto 200 MHz |
| Urban + Massive Connections | 700 MHz OR Optionally 2100 MHz |
Reference : TR 38.913 Study on scenarios and requirements for next generation access technologies
mmWave frequency is > 30 GHz
5G New Technology
1. mmWave frequency is > 30 GHz
2. Massive MIMO > 8 x 8 MIMO
3. Beam Management
4. LDPC coding (for U-Plane) and Polar coding (for C-Plane)
5. AS Layer
6. UL Waveform
7. Subframe structure
8. HARQ
9. SDN
10. NFV
11. Grant-free UL for IoT
Numerologies
1 frame = 10 subframe
1 subframe's slot = f (n)
1 slot = 14 symbols
So 1 frame's slot = 10 x f(n)
So 1 subframe's symbols = 14 x f(n)
So 1 frame's symbol = 10 x 14 x f(n) = 140 x f(n)
Numerology
|
Sub carrier BW (kHz)
Delta F = 2 ** n x 15
|
12 x Delta F
|
Remark
|
Slot / subframe
|
Slot / frame
|
Symbol / subframe
|
Symbol / frame
|
|---|---|---|---|---|---|---|---|
0
|
15
|
180 kHz
|
Below 1GHz
1 GHz to 6 GHz
|
1
|
10
|
14
|
140
|
1
|
30
|
360 kHz
|
Below 1GHz
1 GHz to 6 GHz
|
2
|
20
|
28
|
280
|
2
|
60
|
729 kHz
|
1 GHz to 6 GHz
24 GHz to 52.6 GHz
|
4
|
40
|
56
|
560
|
3
|
120
|
1.44 MHz
|
24 GHz to 52.6 GHz
|
8
|
80
|
112
|
1120
|
4
|
240
|
2.88 MHz
|
16
|
160
|
224
|
2240
| |
5
|
380
|
5.76 MHz
|
32
|
320
|
448
|
4480
|
Slot Format
TDD or FDD depends upon
0 : All 14 Symbols are D
1 : All 14 Symbols are U
2 : X
3 : 13 D + 1 X
4: 12 D + 2 X
5 : 11 D + 3 X
D = Downlink
U = Uplink
X = Flexible
To be continued...







