Wednesday, July 6, 2022

Eigenfaces: An application of Principal Component Analysis (precisely Dimensionality Reduction)

(The above image represents 16 eigenfaces for about a 1000 different images of human faces. Image Source: same link as for "towardsdatascience" page mentioned below.)

    I just came across the concept of having human faces as eigen vectors and this is simply awesome! This concept can be used to store compressed version of individual human faces(this saves storage space) and those individual faces can still be reconstructed to have a good approximation of their original versions. All this can be done using the basic concept of machine learning called Principal Component Analysis! Please checkout this crisp explanation from "towardsdatascience" page to know more about this topic.

Link: https://towardsdatascience.com/eigenfaces-recovering-humans-from-ghosts-17606c328184

Saturday, June 11, 2022

Interpretability v/s Flexibility for different statistical learning methods

 

(Source: An Intoduction to Statistical Learning with Applications in R written by James G., Witten D., Hastie T. and Tibshirani R. and published by Springer Text in Statistics. This is a part of my machine learning specialization course from CU Boulder.)

    I learned from this topic that we can choose a method from multiple statistical learning topics based on our goal. This book shares an example saying that if we are interested in predicting the accurate values in the stock market and not much concerned about inference (how each predictor variable is associated with the output), we can use high-flexibility approaches like deep learning. However, if we are concerned about the inference, we can use high-interpretability models like Lasso or Least-squares. The book also states that sometimes the high-interpretability models give more accurate results.

Wednesday, June 8, 2022

Birefringence

    Aside from dispersion, materials usually have the same index of refraction for all orientations of the electric field in the light. However, some materials, usually nearly pure crystals, have two indices of refraction for the same wavelength of light. The difference is due only to the orientation of the light's electric field. Therefore, light with its electric field oscillating in the vertical direction experiences a different index of refraction from the index of refraction for an electric field oscillating in the horizontal direction. This is called birefringence(Source: Optics for Dummies by Duree)

Thursday, June 2, 2022

Variables in a Linear Regression model (machine learning)

There are two types of variables in a dataset in general:
1) Real valued (ex.: 1,2,3,4)
2) Categorical (ex.: Blood Group)
    Categorical variables have two sub-types:
    a) Ordinal (ex.: Age group 25-55, or Grades A-D)
    b) Non-ordinal (ex.: Male/Female, Plant/Animal)

    It is comparatively easy to build linear regression model around real-values and ordinal-categorical variables that can relate to regression. However, nonordinal-categorical variables pose a problem for a "regression" model. This is  because the regression equations,

y = a0 + a1X1 + a2X2 +....

cannot rely on their arbitrary nature to predict output values. Nonetheless, these nonordinal categorical variables can always be transformed into real-valued or binary forms to make use of them in a regression problem.

Tuesday, November 23, 2021

Mangin Mirror to Resolve Spherical Aberration

Most imaging systems face the problem of spherical aberration when trying to focus light on an image plane. A Mangin mirror, which is a mirror with a positive focal length (concave shape for mirrors) when placed alongside a lens with negative meniscus, is known to resolve for spherical aberration.



Figure 1. Mangin mirror with a negative meniscus lens in blue color and the mirror in red color. (Source: Wikipedia)

Thursday, June 25, 2020

Important Difference: Method Overloading v/s Method Overriding

Here is a very important difference which leads to confusion for many new programmers:

1) Method Overloading: In the same class, we have two methods with the same name but with different parameters.

2) Method Overriding: In the sub-class, we have a method with the same name as in parent class and with the same parameters. This is usually done to have a different functionality in the sub-class.

Need of Inheritance in Object-oriented Programming

These days, I'm working on my Java programming skills especially object-oriented programming. I have taken a Coursera course for this purpose from UC San Diego. Today, I happened to come across an interesting example from Leo Porter demonstrating the need of inheritance in object-oriented programming. His explanation went as follows:

Inheritance:

Suppose you are working as a Software Engineer in a university. You have written a Person class that provides a blue-print for information of all individuals and it's working as expected. After a few days, the university administration comes to you saying we cannot have the same class for all individuals. We need to have separate classes for students and faculty respectively. One of the options to tackle this problem is to use a boolean operator and set if-else conditions for every method in your class.

Okay, so that works fine for a few days as well. Again, the university administration comes to you saying we cannot have the same class for all the students. We need separate classes for undergrad and grad students. Now, maybe you go for a nested if-else condition. But again you are asked to sort ful-time and part-time students. Now a nested if-else starts getting complicated.

Further, you are being told that you cannot have the same methods for students and faculty. Now you create two classes and name them Students and Faculty respectively. What do you think can go wrong with this?

The problem comes when you have to modify the basic structure of these classes. For example, earlier you had a single variable for storing name of a person. And now you have to store first name and last name in two separate variables. So now you have to make similar changes in both classes. The required changes might be necessary at multiple lines inside a class and the same have to be done line-by-line in another class as well. This is where the job gets tedious.

The solution to this is inheritance! Inheritance allows you to keep some common functionality in the parent class (say Person) and have distinct functionalities in child classes (Students and Faculty in this case). 

Total Magnification

If a microscope has objective magnification (Mo) of 10x and eyepiece magnification (Me) of 10x, then total magnification (Mt) is given as: M...