Monday, January 8, 2024

Regret Minimization in Tech Learning


Welcome, fellow technologists, to the rollercoaster ride that is mastering new technologies! If you've ever felt the sting of regret for not taking the initiative to  learn the latest programming language or diving into a cutting-edge framework, you're not alone. In fact, you're in the majority. Today, we discuss on how to avoid this with the powerful tool of Regret Minimization.

The Fear of Regret

As developers, our love for solving problems often goes hand-in-hand with the fear of missing out on the next big thing. The daunting prospect of regret looms large, whispering, "What if you're left behind? What if your skills become obsolete?" It's a mental bug that we must debug with finesse.

Enter the growth mindset, the ultimate debugger for our cognitive code. 

Regret Minimization starts with the realization that learning is a lifelong process, and every outdated skill is an opportunity to iterate and improve. Just like we debug our programs, we must debug our approach to learning.

Minimizing Regret One Step at a Time

The path to tech mastery is not about sprinting to the finish line; it's about navigating each function, method, and module with precision. Here are some practical steps to minimize regret in the learning process:

1. Set Realistic Milestones:

Instead of aiming to conquer an entire technology stack in one go, set achievable milestones. Break down your learning journey into manageable tasks, and celebrate each accomplishment. Remember, progress is progress, no matter how small the step.

2. Focus on Small Victories:

Tech learning is a series of battles, and every successful line of code written is a victory. Rather than getting overwhelmed by the vastness of a new technology, focus on solving specific problems. Small victories build confidence and pave the way for more significant achievements.

If you're learning a new web framework, start by building a simple "Hello, World!" application. Once that's conquered, gradually add features and complexity.

3. Embrace Incremental Learning:

Just like iterative software development, adopt an incremental learning approach. Learn a concept, apply it in a practical project, and then iterate. This way, you're not just memorizing syntax; you're ingraining the knowledge through hands-on experience.

4. Accept Not Knowing Everything:

One of the biggest sources of regret is the pressure to know it all. Accept that you won't understand every nuance immediately. Tech learning is an ongoing process, and gaps in knowledge are not failures but opportunities to improve your understanding.

For example, in machine learning, start with the fundamental algorithms and build your knowledge gradually. You don't need to grasp advanced concepts immediately.

5. Leverage Learning Resources:

The tech community is rich with resources, remember that somewhere, someone has solved the problem. Leverage tools like stackoverflow, blogs, github, online documentation to your advantage. Don't hesitate to consult to comment on them faced with challenges, as someone will respond and accelerate your learning curve.

Future proofing

In essence a adopting a patient and strategic and continuous approach to learning is essential for , minimizing regret. Each step forward, no matter how small, will contribute to the larger framework of your expertise. 
So, break down the learning process, celebrate the victories, and conquer the challenges one step at a time. 

Friday, December 1, 2023

Equality in AI


AI-based software can inherit and perpetuate existing biases present in the data used to train them. If the training data contains biased or discriminatory patterns, the AI models learn and replicate those biases, potentially exacerbating existing inequalities. 

Training Data Bias

Scenario: Hiring Bias in a Resume Screening Model

Background:

A company develops an AI model to assist in the screening of resumes for job applicants. The goal is to automate the initial phase of the hiring process by identifying qualified candidates based on their resumes.

Training Data:

The training data for the model consists of historical resumes that were used by the company's hiring team to make decisions. The resumes include information about education, work experience, skills, and other relevant details.

Bias in the Training Data:

  • Gender Bias - Generally, hiring data shows a gender bias towards male candidates compared to equally qualified female candidates, leading the model to more positively with males.
  • Education Bias - The model may learn to prefer candidates from these specific institutions, potentially leading to biased hiring decisions against candidates from less-known or non-traditional educational backgrounds.
  • Experience Bias - The historical hiring decisions may indicate a bias towards candidates with a certain experience in the industry. The model may learn to favor candidates with a specific  experience, potentially excluding qualified candidates with limited experiences.

Impact on the Model:

As a result of these biases in the training data, the AI model may inadvertently favor male candidates, candidates from prestigious universities, or those with a specific type of work experience.


Algorithmic Bias

Scenario: Movie Recommendation Algorithm

Objective:

An online streaming service develops an algorithm to recommend movies to users based on their viewing history and preferences.

Algorithm Training:

The recommendation algorithm is trained using user data like viewing history, ratings, and genre preferences. The goal is to provide personalized movie recommendations to enhance user satisfaction.

Algorithmic Bias:

  • Genre Bias - If the training data predominantly includes certain genres due to user preferences, the algorithm will start becoming more and more biased towards recommending movies from those genres more frequently. Users with may receive recommendations that are skewed towards some genres, potentially limiting the variety of movies suggested.
  • Popularity Bias - The algorithm, when recommending movies, may prioritize popular or trending titles over lesser-known, independent films. This can result in a feedback loop where popular movies receive more views and further reinforce their prominence in the algorithm's recommendations.

Impact on Recommendations:

Due to these biases, users may find their movie recommendations limited to a narrow set of genres, popular titles, and potentially missing out on discovering a broader range of content.


Data Representation Bias

Scenario: Bias in Predictive Healthcare Model

Objective:

A healthcare organization is developing an AI model to predict patient outcomes based on historical medical data.

Data Representation Bias:

  • Socioeconomic Bias in Health Records - Health records used to train the predictive model may not reflect the correct distribution of socioeconomic status, with a majority of data coming from patients with higher incomes and / or better access to healthcare. 
  • Geographic Bias - If the model is trained on data from urban areas and lacks sufficient representation from rural communities, it may not generalize well to predict outcomes for patients in those underserved regions.

Impact on the Model:

The model may perform well for populations well-represented in the training data but may struggle to generalize to diverse demographic groups.


Equality and AI

It's essential to note that AI has the potential to contribute to more equitable outcomes when designed and implemented with fairness in mind. 
Cognizant steps need to be taken to mitigate bias in AI systems not only when they are designed and implemented, but also over the long term, when the model continuously re-trains itself. 
Ultimately, whether AI exacerbates or mitigates existing biases depends on how it is developed, implemented, and monitored. 
Ethical AI practices and going efforts to improve transparency and fairness are essential for ensuring that AI contributes to a more equal and just society.

Saturday, February 25, 2023

Web3 - Asset Tokenization in Real Estate Industry

 

Photo by Tierra Mallorca on Unsplash

The Real Estate Industry needs a more secure, transparent, and efficient way to manage assets. The traditional process of buying, selling, and managing real estate is often time consuming and cumbersome. NFTs provide a new way to manage real estate transactions faster, more secure, and more transparent manner.

The decentralized nature of blockchain technology makes it possible to transparently transfer ownership of real estate assets without the need for intermediaries, such as banks or real estate agents, thereby reducing the costs. Some of the advantages of using NFT in the real Estate Domain are as follows:

a.   Real-time Asset Management

Real-time asset management refers to the ability to manage real estate assets in real-time, without delay or lag. By tokenizing real estate assets as NFTs, ownership, transfer, and other critical data can be stored on the blockchain, allowing for real-time access and management of these assets.

With real-time asset management, processes such as the transfer of ownership, rent collection, and property management can be completed quickly and efficiently, reducing the time and cost involved in managing real estate assets. Additionally, this real-time access to information about real estate assets allows for better decision-making, as stakeholders can access up to date information about the asset at any time.

b.  Transfer of ownership

The transfer of ownership refers to the process of transferring ownership of a real estate asset from one person or entity to another.

By tokenizing real estate assets as NFTs, ownership of the assets is recorded on the blockchain, making it a tamper-proof and secure record of ownership. When ownership is transferred, the NFT can be transferred to the new owner, representing the transfer of ownership of the real estate asset.

The decentralized nature of blockchain technology ensures that the transfer of ownership is transparent and secure, with a clear and unalterable record of ownership available on the blockchain. This reduces the risk of fraud, counterfeiting, and other ownership disputes.

c. Trading of assets

The trading of assets refers to the buying and selling of real estate assets.

By tokenizing real estate assets as NFTs, these assets can be bought and sold on blockchain platforms, much like stocks or other financial assets. The unique code of each NFT represents ownership of a specific real estate asset, making it possible to buy and sell these assets in a secure and transparent manner.

d. Investment opportunities

The use of NFTs (Non-Fungible Tokens) in real estate provides new investment opportunities for individuals and institutions looking to invest in real estate assets.

NFTs allow real estate assets to be tokenized and traded on blockchain platforms, making it possible to invest in smaller and more affordable portions of real estate assets. This opens up the market to a wider range of investors, including those who might not have previously been able to invest in real estate due to its high cost and barriers to entry.

Furthermore, the real-time asset management, transfer of ownership, and trading capabilities provided by NFTs make it easier for investors to manage their investments and quickly respond to market conditions, providing greater flexibility and control over their investments.

However, the adoption of NFTs in real estate is not without its challenges. Lack of understanding and education, difficulty in integrating NFTs with existing systems, and legal and regulatory considerations are some of the challenges that must be addressed for NFTs to be widely adopted in the real estate industry.

a. Adoption and understanding

One of the potential challenges with the adoption of NFTs in real estate is the general lack of understanding of the technology and its potential benefits. Many people, including investors, buyers, and sellers, may not be familiar with the concept of NFTs and how they can be used in real estate. This lack of understanding may result in a slower rate of adoption and limit the growth potential of the market.

b. Integration with existing systems

Integrating NFTs with existing systems, such as property registries, could pose a challenge. The process of updating these systems to accommodate NFTs may be time-consuming and require significant resources. In addition, there may be concerns about compatibility and interoperability with existing systems, as well as the need to establish new standards for NFTs in the Real Estate Industry.

c. Legal and regulatory considerations

Legal and regulatory considerations may be a potential challenge in the adoption of NFTs in real estate. Laws and regulations around NFTs and tokenization are still in their early stages and may vary across different jurisdictions. This can create uncertainty and make it difficult for stakeholders to understand their rights and responsibilities.

The outlook for NFTs in real estate is promising as the technology continues to evolve and mature. The adoption of NFTs in real estate is expected to grow as more people become aware of the benefits they offer, and the potential challenges are addressed.

Tuesday, January 3, 2023

Exclusionary language, avoid them..........

Photo by Christina @ wocintechchat.com on Unsplash

Avoid exclusionary language at work! 
Unknowingly, there are words or phrases that people use and they are not aware that those words can hurt someone’s sentiments. Perhaps no one uses them deliberately, perhaps, it was just a grammar error, perhaps, everyone has been using these words and hence the continuation till that. However, no matter what, by using these words/phrases, people end up pricking someone’s invisible wounds. 
For example, let us take the phrase ‘Cake Walk’. ‘Cake Walk’ means any kind of work that can be done easily. However, if we look at the etymology of this phrase, this phrase originates from the name of a pre-Civil War dance, pertaining to 19th century. This dance was performed by slaves on plantation grounds to entertain their owners. The best dancers were awarded with a decorated cake. Now, after knowing this, would you still like to use this phrase? 
Although language is a complex entity, it never means it shouldn’t or can’t change. Let us look at some job description examples: Recruitment in military sometimes use terms like ‘Veterans and their Wives’. It automatically assumes that all veterans are male. Not just that, this term also ignores same sex relationships. 
Talking about Database related jobs, there are terms like ‘master / slave’ when it comes to controlling one device over another. This is racially insensitive and inappropriate. Other examples are, ‘Stop crying like a girl’ , ‘My ideas fell on deaf ear’, ‘Your ideas are cripple’, ‘Moron you are….’, these are all hurting phrases, with a pricking insensitive touch. 
Here is what we can do to make our workplace a safe haven with compassion and understanding as its pillars. 
  1. Be self aware: While speaking, speak with an understanding so that you know which words to avoid. Learn what exclusionary words are. Erase them from your vocabulary. If you hear a colleague or friend using such words, make them also aware about how wrong it is to use those words. 
  2. Put Guidelines: If you are a leader, create guardrails for acceptable and unacceptable words and behavior. Check documentation thoroughly before rolling them out. 
  3. Call out bad behavior: Do call out someone who is making another person feel out of place. Let everyone know that bad behavior is never welcome. 

Sources: https://hbr.org/2022/10/how-to-identify-and-eliminate-exclusionary-language-at-work (Harvard Business Review)

Friday, December 23, 2022

Best Practices in React Development

Photo by Lautaro Andreani on Unsplash

1.    Folder Structure

Component-centric file structure should be used which implies that all the files related to a different component (like test, CSS, JavaScript, assets, etc.) should be kept under a single folder.

For ex:

Components

  |

  --Login

    |

    --tests--

    --Login.test.js

    --Login.jsx

    --Login.scss

    --LoginAPI.js

 

2.    HOC

It’s an advanced technique in React which allows reusing component logic inside the render method. An advanced level of the component can be used to transform a component into a higher order of the component. For example, we might need to show some components when the user is logged in. To check this, you need to add the same code with each component. Here comes the use of the Higher-Order Component where the logic to check the user is logged in and keep your code under one app component. While the other components are wrapped inside this.

 

3.    Decompose Big Component

Try to decompose large components into small components such that component performs one function as much as possible. It becomes easier to manage, test, reuse and create a new small components.


4.    Use Functional or Class Components based on Requirement

If you need to show User Interface without performing any logic or state change, use functional components in place of class components as functional components are more efficient in this case.

Try to minimize logic in React lifecycle methods like:

componentDidMount();

componentDidUpdate();

These cannot be used with functional components, but can be used with Class components.

While using functional components, you lose control over the render process. It means with a small change in component, the functional component always re-renders.

 

5.    Naming and Destructuring Props

Use meaningful and short names for props of the component. Also, use props destructuring feature of function which discards the need to write props with each property name and can be used as it is.



6.    Use propTypes for Type Check

It is a good practice to do type checking for props passed to a component which can help in preventing bugs. Please refer below code for how to use


 

7.    Naming Conventions

Use PascalCase in components, interfaces, or type aliases. 


Use camelCase for JavaScript data types like variables, arrays, objects, functions



8.    Avoid Unnecessary DIV tags

BAD:



GOOD:


9.    Remove Unnecessary Comments

Add comments only where it’s required so that you do not get confused while changing code at a later time.

Also don’t forget to remove statements like Console.log, debugger, unused commented code.

 

10.The Rule of Max 3 props inline

When there are three or fewer properties, then you should keep those properties in their line inside both the component and the render function.

Less than 3 props:


More than 3 props:


 

11.Use shorthand for Boolean props

BAD:<RegistrationForm hasPadding={true} withError={true} />

GOOD:<RegistrationForm hasPadding withError />

 

12.Avoid curly braces for string props

BAD:<Paragraph variant={"h5"} heading={"A new book"} />

GOOD:<Paragraph variant="h5" heading="A new book" /> 

13.Write a fragment when a DIV is not needed

 

14.Integrate self-closing tags when no children are needed

BAD: <NavigationBar></NavigationBar>

GOOD: <NavigationBar />

 

15.Apply ES6 Spread Function

Using ES6 methods to send an object attribute would be a more straightforward and effective method. All of the object’s props will be automatically inserted if the phrase “…props” is used between the open and close tags.


 

16.Using Map Function for Dynamic Rendering


 

17.Use ES6 Spread Operator



18.Use Ternary Operators

BAD:     



GOOD:


19.Use Object Literals

BAD:



GOOD:

 


20.Don't Define a Function Inside Render

BAD:



GOOD:

 

21.Use Memo

BAD:

Although the child component should render only once because the value of count has nothing  to do with the ChildComponent . But, it renders each time you click on the button.

GOOD:

Now, no matter how many times you click on the button, it will render only when necessary.


22.CSS in JavaScript

BAD:



GOOD:



23.Use Object Destructuring

BAD:



GOOD:



24.Avoid using string concatenation.

BAD: const userDetails = user.name + "'s profession is" + user.proffession

GOOD: const userDetails = `${user.name}'s profession is ${user.proffession}`

 

25.Import in Order

BAD:



GOOD:

The rule of thumb is to keep the import order like this:

  • Built-in
  • External
  • Internal

 

26.Use Implicit return

BAD:



GOOD:



27.Quotes

BAD:


GOOD:

Use double quotes for JSX attributes and single quotes for all other JS.