Monday, 27 February 2023

Bias Variance Tradeoff

Before we get into bias and variance, it's important to understand the different types of error in machine learning.

  • Reducible error 
These errors can be reduced to improve the model's accuracy. This error can be classified as follows:
    • Bias
    • Variance
  • Irreducible error 
The errors that cannot be reduced and will always be present in models
 
Bias and variance explained
 
Bias is defined as the difference between actual and predicted values; a model with a high bias is oversimplified and less complex and doesn't perform better on test or training data.
 
Variance is defined as the amount of variation in prediction if different training data is used; ideally, there should not be much variation when the model is changed. High variance implies that the model was not able to map input and output variables.


Tuesday, 14 February 2023

Best Practices: How to Write Clean Python Code

Best Practices: How to Write Clean Python Code

Following are things one should consider while writing machine learning code.

1) Right names 

One should provide correct names to variables, functions, data frames, etc. so that one can easily interpret the meaning.

2) Consistent with naming conventions

Always follow the same writing convention across the code.

3) Proper documentation and comments

One should add comments to provide a description of the task to be performed by code.

4) Avoid using redundant text while writing code or providing any description; -Text / name must be easily interpretable 

5) Avoid Duplication: Avoid duplication in code by using the same function for one task instead of writing different functions, also applies to other things 

Monday, 6 February 2023

What is Natural Language Processing ?

Natural Language Processing (NLP) is a field of study that focuses on the interactions between human natural language and computers. The goal of NLP is to enable computers to understand, interpret, and generate human language. It is an interdisciplinary field that encompasses computer science, artificial intelligence, linguistics, and cognitive psychology. NLP techniques use a combination of machine learning, deep learning, and computational linguistic methods to process and analyze natural language text or speech.

These applications allow computers to understand and interpret human language, making it possible for machines to interact with humans in a more natural way.

Applications of NLP 

  1. Text to speech: Transforming text data to speech. Example -Reading articles and generating the article (text) in speech form.
  2. Speech to text : Transforming speech to text . Example - Subtitles in movies.
  3. Language translation : Translating text in one language to other. Example - Google translator 
  4. Sentiment analysis : Analyzing sentiments of text to identify the emotional tone in text. Example - Analysis of product reviews and finding sentiments in terms of positive, negative and neutral
  5. Text summarization: Breaking large text into small so that it can be summarized in small text. Example - Book summary in few sentences
  6. Named Entity Recognition: Identify key information from the text and classify into pre-defined categories. Example- Shahrukh Khan belongs to India (Location- India)
  7. Question Answering: Providing answers to questions asked. Example :Q- Capital of India, A- Delhi
  8. Dialogue Systems: System that interacts with human in natural language. Example -ChatGPT
  9. Language Generation- Natural Language Generation (NLG) using machine learning and artificial intelligence. Example - Product descriptions
  10. Language Understanding : Natural Language Understanding (NLU)  is used to understand users input either from text or speech by understanding intent. Example - Need to travel to USA-NLU understand intent i.e. travel ,location -USA