Monday, July 29, 2024

Interview at Nagarro for Data Scientist Role (Jul 27, 2024)

Find out more: Index For Interviews Preparation For Data Scientist Role
Q1: Tell about yourself.

Q2: What all Python packages you have worked on?

Q3: What are embeddings?

Embeddings are a type of representation for text, images, or other data types that map high-dimensional inputs into lower-dimensional vector spaces. In the context of natural language processing (NLP) and machine learning, embeddings are particularly useful because they enable the representation of words, phrases, or even entire documents as dense vectors of real numbers. These vectors capture semantic meaning in such a way that similar concepts are located near each other in the embedding space.

Key Concepts of Embeddings

Dimensionality Reduction: Embeddings reduce the dimensionality of data while preserving meaningful relationships. For example, words in a high-dimensional vocabulary are mapped to lower-dimensional vectors. Semantic Representation: Embeddings capture semantic similarities. Words with similar meanings are represented by vectors that are close to each other in the embedding space. For instance, the words "king" and "queen" might be close in the vector space. Contextual Information: Advanced embeddings like those produced by models such as BERT or GPT capture contextual information, meaning the representation of a word can change based on the surrounding words.

Types of Embeddings

Word Embeddings: Word2Vec: Trains shallow neural networks to predict the context given the word (Skip-gram) or predict a word given the context (CBOW - Continuous Bag of Words). Trick to remember: C for 'given the Context' and C for CBOW. GloVe (Global Vectors for Word Representation): Combines the benefits of local context window methods and global matrix factorization methods. FastText: An extension of Word2Vec that considers subword information, making it robust to out-of-vocabulary words. Contextual Embeddings: BERT (Bidirectional Encoder Representations from Transformers): Generates embeddings that consider the context of a word within a sentence. The same word can have different embeddings based on its usage. GPT (Generative Pre-trained Transformer): Produces embeddings that are used for generating text based on a given context. Sentence and Document Embeddings: Doc2Vec: Extends Word2Vec to create vectors for entire documents. Universal Sentence Encoder: Produces embeddings for sentences and paragraphs, designed to capture the meaning of longer text segments. Image Embeddings: Used in computer vision to represent images as vectors. These embeddings are typically generated using convolutional neural networks (CNNs).

Applications of Embeddings

Text Similarity and Search: Embeddings are used to find similar documents or sentences by comparing their vector representations. For example, in search engines, embeddings can improve the relevance of search results. Machine Translation: Embeddings facilitate the translation of text from one language to another by capturing the semantic meaning of words and phrases. Recommendation Systems: User and item embeddings can be used to recommend products, movies, or music based on similarities in the embedding space. Sentiment Analysis: Embeddings can help in understanding the sentiment of a piece of text by capturing the nuanced meaning of words and phrases.
~~~ Q4: What is the difference between one-hot encoding and embeddings? One-hot encoding and embeddings are both techniques used to represent categorical data, particularly in natural language processing (NLP) and machine learning. However, they differ significantly in their methodology, storage efficiency, and ability to capture semantic meaning.

One-Hot Encoding

Definition: One-hot encoding is a representation of categorical variables as binary vectors. Each category or word is represented by a vector where only one element is "hot" (i.e., set to 1) and all other elements are "cold" (i.e., set to 0). Characteristics: Dimensionality: The length of each one-hot vector equals the number of unique categories in the dataset. For a vocabulary of size V, each one-hot vector is of length V. Sparsity: One-hot vectors are sparse, containing mostly zeros except for a single 1. No Semantic Information: One-hot encoding does not capture any semantic relationships between categories. Each category is equidistant from every other category. Memory Inefficiency: For large vocabularies, one-hot encoding can be very memory-intensive due to the high dimensionality and sparsity. Example: For a vocabulary of {apple, banana, orange}: apple: [1, 0, 0] banana: [0, 1, 0] orange: [0, 0, 1] Definition: Embeddings are dense vector representations of categorical data. Each category or word is mapped to a vector of fixed size, typically much smaller than the size of the vocabulary. Embeddings are learned from data and can capture semantic relationships.

Characteristics

Dimensionality: The length of each embedding vector is much smaller than the number of unique categories, typically ranging from 50 to 300 dimensions. Density: Embedding vectors are dense, with most elements being non-zero. Semantic Information: Embeddings capture semantic meanings and relationships. Words with similar meanings have similar vectors (i.e., are close in the embedding space). Memory Efficiency: Embeddings are more memory-efficient compared to one-hot encoding due to their lower dimensionality. Example: For a vocabulary of {apple, banana, orange}, with embeddings of size 3: apple: [0.1, 0.3, 0.5] banana: [0.2, 0.4, 0.6] orange: [0.0, 0.2, 0.4]
AspectOne-Hot EncodingEmbeddings
DimensionalitySize of vocabulary (V)Fixed size (e.g., 50-300)
Vector TypeSparseDense
Semantic InformationNoYes
Memory EfficiencyLow (due to high dimensionality)High (due to lower dimensionality)
Training RequirementNone (deterministic)Requires training (or pre-trained)
Relationship CaptureNo relationships between categoriesCaptures relationships between words

Use Cases

One-Hot Encoding: Suitable for categorical variables with a small number of unique categories. Often used in traditional machine learning algorithms that cannot directly handle categorical variables (e.g., decision trees, linear models). Embeddings: Suitable for large vocabularies, especially in NLP tasks. Used in deep learning models such as neural networks for tasks like text classification, machine translation, and sentiment analysis. Commonly used pre-trained embeddings include Word2Vec, GloVe, and embeddings from transformer models like BERT and GPT.
~~~ Q5: What is Count Vectorizer? The Count Vectorizer is a technique used to convert a collection of text documents into a matrix of token counts. It is a simple and commonly used method for feature extraction in natural language processing (NLP) and text analysis. The idea is to represent each document as a vector of word counts, which can then be used as input for various machine learning algorithms.

How Count Vectorizer Works

Tokenization: The text documents are tokenized, meaning they are split into individual words or tokens. Building the Vocabulary: A vocabulary (or dictionary) is built from the unique tokens across the entire corpus of documents. Counting Tokens: For each document, the number of occurrences of each token in the vocabulary is counted. Vector Representation: Each document is represented as a vector of token counts, where each element of the vector corresponds to the count of a specific token from the vocabulary. Example Suppose we have the following documents: "I love programming" "Programming is fun" "I love machine learning" The Count Vectorizer would perform the following steps: Tokenization: Document 1: ["I", "love", "programming"] Document 2: ["Programming", "is", "fun"] Document 3: ["I", "love", "machine", "learning"] Building the Vocabulary: Vocabulary: {"I", "love", "programming", "is", "fun", "machine", "learning"} Counting Tokens: Document 1: [1, 1, 1, 0, 0, 0, 0] Document 2: [0, 0, 1, 1, 1, 0, 0] Document 3: [1, 1, 0, 0, 0, 1, 1]

Advantages of Count Vectorizer

Simplicity: Easy to understand and implement. Efficiency: Suitable for many text classification tasks. Foundation for Other Techniques: Forms the basis for more advanced techniques like TF-IDF (Term Frequency-Inverse Document Frequency).

Limitations of Count Vectorizer

Sparsity: The resulting vectors can be very sparse, especially for large vocabularies. Ignoring Context: It does not consider the context or order of words, only their frequency. High Dimensionality: The size of the vectors increases with the size of the vocabulary, which can lead to high-dimensional data that is computationally expensive to process. No Semantic Understanding: Similar words or synonyms are treated as entirely separate features. Despite these limitations, Count Vectorizer is a valuable tool for initial text processing and feature extraction in NLP pipelines.
~~~ Q6: Brief about Word2Vec? Word2Vec is a popular technique for natural language processing (NLP) that involves training a shallow neural network model to learn dense vector representations of words. These vector representations, known as word embeddings, capture the semantic relationships between words in a continuous vector space. Developed by a team of researchers led by Tomas Mikolov at Google in 2013, Word2Vec has been influential in advancing the field of NLP.

Key Concepts of Word2Vec

Distributed Representations: Unlike traditional one-hot encoding, which represents words as sparse vectors, Word2Vec represents words as dense vectors of real numbers. This allows the model to capture more information about the relationships between words. Semantic Similarity: Words with similar meanings are located close to each other in the vector space. For example, the words "king" and "queen" might have vectors that are close together, reflecting their semantic similarity. Contextual Information: Word2Vec captures the context of words in a corpus, which helps in understanding their meanings based on surrounding words.

Training Word2Vec

Word2Vec can be trained using two main approaches: Continuous Bag of Words (CBOW): In the CBOW model, the objective is to predict a target word given its context (the surrounding words). This model averages the context word vectors to predict the target word. Skip-gram: In the Skip-gram model, the objective is to predict the context words given a target word. This model is particularly effective for smaller datasets and captures more fine-grained information about word relationships.

Applications of Word2Vec

Similarity and Analogy Tasks: Word2Vec can be used to find similar words and perform analogy tasks. For example, finding the word that is to "queen" as "king" is to "man". Text Classification: Embeddings from Word2Vec can be used as features in text classification tasks, such as sentiment analysis or spam detection.

Advantages of Word2Vec

Semantic Understanding: Captures semantic relationships between words, making it useful for various NLP tasks. Efficient Training: Word2Vec is computationally efficient and can be trained on large datasets relatively quickly. Flexibility: Can be fine-tuned for specific tasks and integrated into larger machine learning pipelines.

Limitations of Word2Vec

Context Independence: Word2Vec generates a single vector representation for each word, regardless of its context in a sentence. This can be a limitation for words with multiple meanings (polysemy). Static Embeddings: The embeddings are static once trained and do not change with new data unless retrained. Requires Large Datasets: To capture meaningful relationships, Word2Vec requires a large corpus for training.
~~~ Q7: Brief about the Architecture of Word2Vec. Skip-Gram model:
Continuous Bag of Words:
~~~ Q8: Brief about Anomaly detection and following three types of models that you tried: - Auto encoder - K-medians - Isolation Forest ~~~ Q9: Provide the End-to-end project description for the Anomaly Detection project. ~~~ Q10: Is it correct to say if maximise negative of log-likelihood of an observation to detect anomalies? Maximizing the negative log-likelihood of an observation is not typically used for anomaly detection. Instead, minimizing the negative log-likelihood is more common in training machine learning models. To detect anomalies, one would often look for observations that have low likelihoods (or high negative log-likelihoods) under a given model, rather than maximizing the negative log-likelihood. Understanding Negative Log-Likelihood (NLL) Log-Likelihood: In a probabilistic model, the likelihood of an observation is the probability of the observation given the parameters of the model. The log-likelihood is simply the natural logarithm of the likelihood. Taking the logarithm helps in dealing with very small probability values and can simplify the differentiation process during optimization. Negative Log-Likelihood: The negative log-likelihood (NLL) is the negative of the log-likelihood. Minimizing the NLL is equivalent to maximizing the likelihood. In many machine learning models, such as neural networks, we minimize the NLL during training to find the best model parameters. Anomaly Detection In anomaly detection, the goal is to identify observations that deviate significantly from the normal behavior captured by the model. Here’s how the concept of log-likelihood can be applied: Train a Probabilistic Model: Train a model on normal (non-anomalous) data to capture the distribution of normal behavior. Compute Log-Likelihoods: For each new observation, compute the log-likelihood under the trained model. Identify Anomalies: Observations with low likelihoods (equivalently, high negative log-likelihoods) are considered anomalies. These are points that the model considers unlikely under the learned distribution of normal data. Example Consider a Gaussian Mixture Model (GMM) for anomaly detection: Train GMM on Normal Data: python Copy code from sklearn.mixture import GaussianMixture # Assume X_train contains normal data gmm = GaussianMixture(n_components=2).fit(X_train) Compute Log-Likelihoods: python Copy code # Assume X_test contains new observations log_likelihoods = gmm.score_samples(X_test) Detect Anomalies: python Copy code # Set a threshold for anomaly detection threshold = -10 anomalies = X_test[log_likelihoods < threshold] In this example, gmm.score_samples(X_test) returns the log-likelihood of each observation in X_test. Observations with log-likelihoods below the threshold are considered anomalies.

Summary

Training Phase: Minimize negative log-likelihood to learn model parameters. Detection Phase: Identify anomalies by looking for observations with low likelihoods (high negative log-likelihoods). Therefore, it is not correct to say that maximizing the negative log-likelihood of an observation is used to detect anomalies. Instead, we use the concept of likelihood (or log-likelihood) to find observations that are unlikely under the model and thus potential anomalies.
~~~ Q11: What is ginie index?

The Gini index, also known as the Gini impurity, is a metric used to evaluate the quality of a split in decision tree algorithms, such as CART (Classification and Regression Trees). It measures the degree of impurity or diversity in a dataset. The lower the Gini index, the less impure the node is, meaning that it is more homogenous.

Definition

The Gini index for a node tt is defined as:

G(t)=1i=1Cpi2G(t) = 1 - \sum_{i=1}^{C} p_i^2

where:

  • CC is the number of classes.
  • pip_i is the proportion of instances of class ii in the node.

Interpretation

  • Gini Index of 0:
    • Indicates a pure node, where all instances belong to a single class.
  • Gini Index of 0.5:
    • Indicates a completely impure node, where the instances are uniformly distributed across all classes (in the case of two classes).

Example Calculation

Suppose we have a node with the following class distribution:

  • Class A: 3 instances
  • Class B: 2 instances

The total number of instances NN is 5. The proportions are:

  • pA=35=0.6p_A = \frac{3}{5} = 0.6
  • pB=25=0.4p_B = \frac{2}{5} = 0.4

The Gini index for this node is:

G(t)=1(0.62+0.42)=1(0.36+0.16)=10.52=0.48G(t) = 1 - (0.6^2 + 0.4^2) = 1 - (0.36 + 0.16) = 1 - 0.52 = 0.48

Usage in Decision Trees

In decision tree algorithms, the Gini index is used to select the best feature to split the data at each node. The algorithm chooses the feature that minimizes the weighted sum of the Gini indices of the child nodes, effectively selecting the split that produces the most homogenous child nodes.

Pseudocode for Gini Index in Decision Tree Split

python
def gini_index(groups, classes): # Count all samples at split point n_instances = float(sum([len(group) for group in groups])) # Sum the Gini index for each group gini = 0.0 for group in groups: size = float(len(group)) # Avoid division by zero if size == 0: continue score = 0.0 # Score the group based on the score for each class for class_val in classes: p = [row[-1] for row in group].count(class_val) / size score += p * p # Weight the group score by its relative size gini += (1.0 - score) * (size / n_instances) return gini

In this pseudocode:

  • groups is a list of groups formed by splitting the dataset on a particular feature.
  • classes is a list of unique class values in the dataset.
  • The function calculates the Gini index for each group and returns the weighted sum of the Gini indices.

Conclusion

The Gini index is a fundamental concept in decision tree learning, used to evaluate the quality of splits and guide the tree-building process. By selecting splits that minimize the Gini index, decision trees aim to create nodes that are as pure as possible, leading to more accurate and interpretable models.

~~~ Q12: How do you do attribute selection for building a decision tree? Attribute selection for building a decision tree involves choosing the most informative features to split the data at each node in the tree. The goal is to select attributes that maximize the purity of the child nodes, thus improving the decision tree's ability to correctly classify the data. The most commonly used criteria for attribute selection in decision trees are Gini Index, Information Gain, and Gain Ratio.

Steps in Attribute Selection

Calculate the Splitting Criteria for Each Attribute: Gini Index: Measures the impurity of a dataset. Lower values indicate purer nodes. Information Gain: Measures the reduction in entropy (disorder) after a dataset is split on an attribute. Gain Ratio: Adjusts the information gain by taking into account the intrinsic information of a split, addressing the bias towards attributes with many values. Choose the Attribute with the Best Split: Select the attribute that either minimizes the Gini Index or maximizes the Information Gain or Gain Ratio. Repeat the Process for Child Nodes: Recursively apply the attribute selection process to the child nodes until stopping criteria are met (e.g., maximum tree depth, minimum number of samples per leaf, or no further information gain).
~~~ Q13: Which ones are faster Boosting algorithms or Bagging Algorithms? In general, Bagging algorithms tend to be faster than Boosting algorithms. Here’s a detailed comparison of both techniques in terms of speed and computational complexity:

Bagging Algorithms

Characteristics: Parallel Training: Bagging (Bootstrap Aggregating) algorithms train multiple base learners (e.g., decision trees) independently in parallel. Each learner is trained on a different bootstrap sample of the training data. Less Sequential Dependency: Since each base learner is trained independently, the overall training process can be parallelized, making it faster and more efficient. Examples: Random Forest is a common example of a bagging algorithm. Speed: Training Speed: Bagging is generally faster because each model can be trained independently and in parallel. Prediction Speed: Bagging can also be faster during prediction because the models are independent, and predictions from each model can be averaged in parallel.

Boosting Algorithms

Characteristics: Sequential Training: Boosting algorithms train base learners sequentially. Each new learner is trained to correct the errors made by the previous learners. High Sequential Dependency: The training of each base learner depends on the performance of the previous learners, leading to a more sequential and thus slower process. Examples: AdaBoost, Gradient Boosting Machines (GBM), XGBoost, and LightGBM are common examples of boosting algorithms. Speed: Training Speed: Boosting is generally slower due to the sequential nature of training. Each new model needs to be trained based on the performance of the previous model, which prevents parallel training. Prediction Speed: Boosting can also be slower during prediction because the predictions are made sequentially by each model in the boosting chain.

Detailed Comparison

1. Training Speed Bagging: Faster training due to parallelism. All base models are trained independently, and the process can take advantage of multiple CPU cores or distributed computing. Boosting: Slower training because models are built sequentially. Each model corrects the errors of the previous ones, preventing parallel training. 2. Prediction Speed Bagging: Predictions can be made relatively quickly because each model's prediction can be computed in parallel and then averaged or voted upon. Boosting: Predictions can be slower because they involve sequentially aggregating the results of all models in the boosting chain. 3. Scalability Bagging: More scalable due to parallelizable nature, especially beneficial for large datasets and distributed computing environments. Boosting: Less scalable due to the sequential dependency of the models.

Summary

Bagging algorithms (e.g., Random Forest) are generally faster in both training and prediction phases due to their parallelizable nature. Boosting algorithms (e.g., XGBoost, LightGBM) are typically slower due to the sequential training process and the dependency of each model on the performance of the previous ones. However, it’s important to note that boosting algorithms often achieve higher accuracy and better performance on certain tasks due to their sequential learning process and the focus on correcting errors from previous models. The choice between bagging and boosting should depend on the specific requirements of your problem, including the trade-offs between speed and accuracy.
~~~ Q14: What is confusion matrix? A confusion matrix is a performance measurement tool for machine learning classification problems. It is a table that is used to describe the performance of a classification model (or "classifier") on a set of test data for which the true values are known. The confusion matrix itself is relatively simple to understand, but the terminology can be a bit confusing. Components of a Confusion Matrix A confusion matrix for a binary classifier is a 2x2 matrix with the following structure: Predicted Positive Predicted Negative Actual Positive True Positive (TP) False Negative (FN) Actual Negative False Positive (FP) True Negative (TN) For a multi-class classification problem, the matrix would be larger, with dimensions corresponding to the number of classes. Definitions True Positive (TP): The number of correct positive predictions. True Negative (TN): The number of correct negative predictions. False Positive (FP): The number of incorrect positive predictions (also known as Type I error). False Negative (FN): The number of incorrect negative predictions (also known as Type II error). ~~~ Q15: When do you use Precision and when do you use Recall? Provide an example. Answer:

Precision and recall are two important metrics used to evaluate the performance of classification models, especially in contexts where class distribution is imbalanced or where the costs of false positives and false negatives differ significantly.

Precision

Definition: Precision measures the proportion of true positive predictions out of all positive predictions made by the model.

Precision=True PositivesTrue Positives+False Positives\text{Precision} = \frac{\text{True Positives}}{\text{True Positives} + \text{False Positives}}

When to Use:

  • High Cost of False Positives: When the cost of incorrectly labeling a negative instance as positive is high, precision is crucial. For example, in medical diagnostics, false positives (e.g., diagnosing a healthy person with a disease) can lead to unnecessary stress and additional testing.
  • Precision-Oriented Tasks: When you need to ensure that the positive predictions you make are highly reliable.

Example: Suppose you are developing a spam email filter. Precision is important if you want to avoid marking legitimate emails as spam. A high precision means that when your model classifies an email as spam, it is likely to be spam.

Recall

Definition: Recall measures the proportion of true positive predictions out of all actual positives in the dataset.

Recall=True PositivesTrue Positives+False Negatives\text{Recall} = \frac{\text{True Positives}}{\text{True Positives} + \text{False Negatives}}

When to Use:

  • High Cost of False Negatives: When missing positive instances is costly or dangerous, recall is crucial. For example, in cancer screening, a false negative (failing to detect a disease when it is present) can have severe consequences.
  • Recall-Oriented Tasks: When you want to capture as many positive instances as possible, even if it means including some false positives.

Example: In a disease outbreak detection system, recall is crucial to ensure that as many actual cases as possible are detected, even if it means some healthy individuals might be incorrectly flagged as potentially infected.

Example Scenario

Scenario: Consider a model designed to identify fraudulent transactions in a banking system.

  • Precision: If the model has high precision, it means that when it flags a transaction as fraudulent, it is likely to be fraudulent. This is important to reduce the number of legitimate transactions mistakenly flagged as fraud, which can cause inconvenience for customers.

  • Recall: If the model has high recall, it means it detects a high proportion of all fraudulent transactions. This is important to ensure that as many fraudulent activities as possible are caught, even if it means flagging some legitimate transactions as fraudulent.

Trade-Off Between Precision and Recall

In many cases, there is a trade-off between precision and recall. Improving one often reduces the other. For example, setting a higher threshold for classifying a transaction as fraudulent will increase precision (fewer legitimate transactions are incorrectly classified as fraud) but may decrease recall (some fraudulent transactions might be missed).

Balancing Act:

  • F1 Score: To balance precision and recall, you can use the F1 score, which is the harmonic mean of precision and recall. It provides a single metric that considers both false positives and false negatives.

F1 Score=2×Precision×RecallPrecision+Recall\text{F1 Score} = 2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precision} + \text{Recall}}

Summary

  • Use Precision: When false positives are costly and you want to ensure that positive predictions are reliable.
  • Use Recall: When false negatives are costly and you want to capture as many positive instances as possible.

Choosing the appropriate metric depends on the specific context and the costs associated with false positives and false negatives in your application.

~~~ Q16: Calculate precision and recall for this given confusion matrix. ~~~ Q17: How many jumps it would take to climb a 100 storey building if you double your strength with every jump? And you start with 1 storey a jump.

To determine how many jumps it would take to climb a 100-storey building if you double your strength with each jump, starting with the ability to jump 1 storey on the first jump, we can use the concept of geometric progression.

Understanding the Problem

  1. Initial Jump Strength: 1 storey (on the first jump)
  2. Doubling Factor: After each jump, the jumping strength doubles.

Calculation

  • Jump 1: You jump 1 storey.
  • Jump 2: You jump 1×2=21 \times 2 = 2 storeys.
  • Jump 3: You jump 2×2=42 \times 2 = 4 storeys.
  • Jump 4: You jump 4×2=84 \times 2 = 8 storeys.

And so on. The number of storeys you can jump after nn jumps is given by 2(n1)2^{(n-1)}.

To find the number of jumps required to reach or exceed 100 storeys, we need to find the smallest nn such that:

i=0n12i100\sum_{i=0}^{n-1} 2^i \geq 100

The sum of the first nn terms of a geometric series is:

Sum=20+21+22++2(n1)=2n1\text{Sum} = 2^0 + 2^1 + 2^2 + \ldots + 2^{(n-1)} = 2^n - 1

So we need:

2n11002^n - 1 \geq 100

Solving for nn:

  1. Find nn such that:

    2n1012^n \geq 101

  2. Calculate powers of 2 to find the smallest nn:

    • 26=642^6 = 64 (not enough)
    • 27=1282^7 = 128 (sufficient)

So, n=7n = 7 is the smallest integer satisfying 2n1012^n \geq 101.

Conclusion

It would take 7 jumps to climb a 100-storey building if you double your jumping strength with each jump, starting from 1 storey on the first jump.

~~~ Q18: Which all cloud platforms you have used? Q19: What is Delta Table in Databricks? Delta Table is a key feature of Delta Lake, which is an open-source storage layer developed by Databricks to bring ACID (Atomicity, Consistency, Isolation, Durability) transactions and scalable metadata handling to big data workloads. Delta Lake is built on top of existing data lakes (like Apache Spark and Apache Hive) and provides a unified approach to handling streaming and batch data. Key Features of Delta Tables ACID Transactions: Delta Tables support ACID transactions, which ensure that all operations are completed successfully or none are applied, maintaining data integrity. This is crucial for handling concurrent writes and reads. Schema Evolution and Enforcement: Delta Tables allow schema evolution, which means you can modify the schema of the table (add or remove columns) without rewriting the entire dataset. Schema enforcement ensures that the data adheres to the defined schema. Time Travel: Delta Tables support time travel, which lets you query historical versions of the data. This feature is useful for auditing, data recovery, and reproducing experiments. Upserts and Deletes: Delta Tables support upserts (merge operations) and deletes, which are not natively supported by traditional data lakes like HDFS. This enables efficient data updates and deletions. Scalable Metadata Handling: Delta Lake handles metadata at scale efficiently, which is beneficial for large-scale data processing. It avoids the performance bottlenecks associated with traditional data lakes. Data Optimization: Delta Tables provide built-in data optimization features such as data skipping and file compaction, which improve query performance by reducing the amount of data read. Delta Table Architecture Delta Tables are built on top of existing file formats (e.g., Parquet) and add a transaction log to manage changes. The architecture includes: Data Files: Actual data is stored in Parquet files or other file formats. Transaction Log: A Delta Log (stored as a series of JSON files) tracks all changes to the table. It contains metadata about the table, including schema changes, additions, deletions, and data modifications. Checkpoint Files: Periodic snapshots of the transaction log are saved to improve read performance and recovery times. Basic Operations with Delta Tables Here’s how you typically interact with Delta Tables using Databricks: Create a Delta Table: CREATE TABLE delta_table USING DELTA AS SELECT * FROM source_table; Write Data to a Delta Table: df.write.format("delta").mode("append").save("/path/to/delta_table") Read Data from a Delta Table: df = spark.read.format("delta").load("/path/to/delta_table") Update Data in a Delta Table: from delta.tables import DeltaTable delta_table = DeltaTable.forPath(spark, "/path/to/delta_table") delta_table.alias("t").merge( source_df.alias("s"), "t.id = s.id" ).whenMatchedUpdate(set={"value": "s.value"}) \ .whenNotMatchedInsert(values={"id": "s.id", "value": "s.value"}) \ .execute() Time Travel: df = spark.read.format("delta").option("timestampAsOf", "2023-01-01").load("/path/to/delta_table") Optimize and Vacuum: delta_table.optimize() delta_table.vacuum(retentionHours=168) Conclusion Delta Tables provide a robust and flexible framework for managing data in a data lake, combining the advantages of traditional data lakes with features that support ACID transactions, schema evolution, and efficient metadata management. This makes them a powerful tool for handling large-scale data processing and analytics workloads in Databricks.
Tags: Technology,Machine Learning,Natural Language Processing,Interview Preparation,

Natural Language Processing Books (Jul 2024)

To See All Tech Related Book Lists: Index of Book Lists And Downloads
Download Books

Legend

Red Italic: Also in Apr 2020 Listing [ Ref: 2020 Listing ]

Blue & Upright: New Additions in Jul 2024 Listing Blue & Bold: New Additions About Transformers in Jul 2024 Listing

Listing

1. Speech and Language Processing Daniel Jurafsky, 2000 2. Natural Language Processing with Python Steven Bird, 2009 3. Foundations of Statistical Natural Language Processing Christopher D. Manning, 1999

4. Practical Natural Language Processing: A Comprehensive Guide to Building Real-World NLP Systems Harshit Surana, 2020

5. Natural Language Processing in Action: Understanding, Analyzing, and Generating Text with Python Hannes Hapke, 2019 6. Neural Network Methods in Natural Language Processing Yoav Goldberg, 2017 7. Natural Language Processing with PyTorch: Build Intelligent Language Applications Using Deep Learning Delip Rao, 2019 8. Handbook of Natural Language Processing 2010 9. Text Mining with R: A Tidy Approach Julia Silge, 2017 10. The Handbook of Computational Linguistics and Natural Language Processing 2010 11. Taming Text: How to Find, Organize, and Manipulate It Thomas S. Morton, 2012 12. The Oxford Handbook of Computational Linguistics Ruslan Mitkov, 2003 13. Introduction to Natural Language Processing Jacob Eisenstein, 2019

14. Natural Language Processing with Transformers Lewis Tunstall, 2022 15. Transformers for Natural Language Processing: Build Innovative Deep Neural Network Architectures for NLP with Python, PyTorch, TensorFlow, BERT, RoBERTa, and More Denis Rothman, 2021

16. Deep Learning in Natural Language Processing 2018

17. Deep Learning for Natural Language Processing Stephan Raaijmakers, 2022

18. Big Data Analytics Methods: Modern Analytics Techniques for the 21st Century: the Data Scientist's Manual to Data Mining, Deep Learning & Natural Language Processing Peter Ghavami, 2016 19. Applied Text Analysis with Python: Enabling Language-Aware Data Products with Machine Learning Tony Ojeda, 2018

20. Getting Started with Natural Language Processing Ekaterina Kochmar, 2022

21. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems Aurelien Geron, 2017 22. Introduction to information retrieval Christopher D. Manning, 2008 23. Deep Learning for Natural Language Processing: Creating Neural Networks with Python Karan Jain, 2018 24. Natural Language Processing with Java: Techniques for Building Machine Learning and Neural Network Models for NLP, 2nd Edition Richard M Reese, 2018 25. Linguistic Fundamentals for Natural Language Processing: 100 Essentials from Morphology and Syntax Emily M. Bender, 2013 26. Deep Learning for NLP and Speech Recognition James Whitaker, 2019

27. Natural Language Understanding James F. Allen, 1987 28. Natural Language Annotation for Machine Learning James Pustejovsky, 2012 29. NATURAL LANGUAGE PROCESSING: A PANINIAN PERSPECTIVE Rajeev Sangal, 1996 30. Transformers for Natural Language Processing and Computer Vision: Explore Generative AI and Large Language Models with Hugging Face, ChatGPT, GPT-4V, and DALL-E 3 Denis Rothman, 2024 31. Mastering Large Language Models with Python Raj Arun R, 2024 32. Natural Language Processing and Information Retrieval U. S. Tiwary, 2008 33. Statistical Machine Translation Philipp Koehn, 2009

34. Python Text Processing with Nltk 2.0 Cookbook: Lite Jacob Perkins, 2011

35. Advanced Natural Language Processing with TensorFlow 2: Build Effective Real-world NLP Applications Using NER, RNNs, Seq2seq Models, Transformers, and More Ashish Bansal, 2021 36. Blueprints for Text Analytics Using Python Jens Albrecht, 2020 37. Applied Natural Language Processing in the Enterprise Ankur A. Patel, 2021

38. Natural Language Processing with TensorFlow: Teach Language to Machines Using Python's Deep Learning Library Thushan Ganegedara, 2018

39. Computational Nonlinear Morphology George Kiraz, 2001

40. Introduction to Machine Learning with Python: A Guide for Data Scientists Sarah Guido, 2016

41. Artificial Intelligence For Dummies John Mueller, 2018 42. Deep Learning: A Visual Approach Andrew Glassner, 2021 43. Quick Start Guide to Large Language Models: Strategies and Best Practices for Using ChatGPT and Other LLMs Sinan Ozdemir, 2023 44. AI and Machine Learning for Coders Laurence Moroney, 2020 45. Machine Learning with PyTorch and Scikit-Learn: Develop Machine Learning and Deep Learning Models with Python Liu Yuxi

46. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow Aurelien Geron, 2022

47. What Is ChatGPT Doing ... and Why Does It Work? Stephen Wolfram, 2023 48. The Business Case for AI: A Leader's Guide to AI Strategies, Best Practices & Real-World Applications Kavita Ganesan, 2022 49. Essential Math for AI Hala Nelson, 2022 50. The AI Revolution in Medicine: GPT-4 and Beyond Peter Lee, 2023 51. The ChatGPT Millionaire: Making Money Online Has Never Been this Easy Neil Dagger, 2023 52. Getting Started with Google BERT. Build and train state-of-the-art NLP models Sudharsan Ravichandiran Packt (2021)

Tags: List of Books,Natural Language Processing,Large Language Models,Generative AI,Deep Learning,

Practice problems on Logistic Regression

To See All ML Articles: Index of Machine Learning

#1

Can we use the function “1 / (1 + x^(-1))” to build a binary classifier like we used Logistic in Logistic Regression? Explain why or why not?

#2

What is Logistic Regression? And since it is a classifier, why do we call this model “Regression”?

#3

Choose the correct option: What does the decision boundary of a Logistic Regression based model look like: 1. For 2D data, a line. 2. For 2D data, a curve.

Logistic Regression is a binary classification algorithm

To See All ML Articles: Index of Machine Learning

We Saw Previously: What is Logistic Regression?

1. Logistic Regression is a binary classification algorithm. However, its multi-class variant also exists and is called Softmax Regression. 2. It is a supervised learning algorithm. 3. Logistic Regression is a probabilistic model. 4. It is applicable for linearly separable data. However, it can be tuned to accommodate for noise in the data.

What is a ‘Classification Algorithm’ or a Classifier?

Classification Algorithm or Classifier helps you identify the class of a data point. As in: Cat vs Dog Loan Default vs Not_Default Healthy vs Unhealthy

There are other types of algorithms / problems as well...

- Classification : This we are covering right now. - Regression : Predict a real-valued function such as house price or monthly expenses. This we saw in Linear Regression video. - Clustering : Grouping of data (which we call clusters) based on their features, similarities and differences. - Outlier Detection : Identifying data point which deviate from the pattern that other 95-98% of majority data points follow. - Dimensionality Reduction : We reduce the number of features in this type of problem through mathematical transformations.

Binary Classifier vs Multi-class Classifier

In Binary Classification, there are two classes. Such as in the example we saw: Team_Wins vs Team_Loses, Loan Default vs Not_Default, Healthy vs Unhealthy. But there are Multi-class Classification problems as well: In this there are more than two classes. Such as in image recognition for cat vs dog vs pig, or problems such as object detection in which we look for all sorts of objects like table, chair, book, car, traffic lights, etc. Another example of Multi-class classification that is worth remembering is Named Entity Recognition (or NER for short) that aims at classifying a word into one of the four/five categories: Person, Place, Organization, Miscellaneous and Not_A_Named_Entity.

Logistic Regression Equation

To See All ML Articles: Index of Machine Learning

What is Logistic Regression?

1. Logistic Regression is a binary classification algorithm. However, its multi-class variant also is there called Softmax Regression. 2. It is a supervised learning algorithm. 3. Logistic Regression is a probabilistic model. 4. It is applicable for linearly separable data. However, it can be tuned to accommodate for noise in the data.

We would arrive at the Logistic Regression equation by the end of this video...

Giving you a glimpse of end result, first:

y = x

This is a simple function. Presented here for the completeness of slides.

y = np.exp(x)

Note: np.exp(x) is equal to e^x or math.e**x in Python. This is monotonically increasing function. Next, we change it to 1 / (e^x) or equivalently to e^(-x).

y = np.exp(-x)

np.exp(-x) ==> e^-x ==> 1/(e^x) Note two things about it: 1: It is monotonically decreasing. 2: The minimum value it takes is 0. So next, we would shift it by 1.

y = 1 + np.exp(-x)

This is just np.exp(-x) shifted by 1. Note two things about it: 1: It is also monotonically decreasing. 2: The minimum value it takes is 1. So next, we would move it to denominator.

y = 1/(1 + np.exp(-x))

Properties of y = 1/(1 + np.exp(-x))

y = 1/(1 + np.exp(-x)) Implies: y = 1/(1 + 1/e^x) 1. It is a continuous function. 2. It is differentiable everywhere. Derivative of sigmoid (σ) is: σ(x)(1−σ(x)) 3. max(y) = 1 4. min(y) = 0 5. It is rotationally symmetric around it’s midpoint at (0, 0.5). What it means in plain English is: 1. Sigmoid has well-defined output range, 2. Easy to optimize, and 3. Has a clear probabilistic interpretation.

What’s with the theta-transpose expression?

Note: “Theta-transpose x” means nothing but dot product of two column (or row) vectors: Vector 1 → θ: [θ1, θ2,…, θn] Vector 2 → x: [x1, x2,…, xn] Then “Theta-transpose x” means: θ1*x1 + θ2*x2 + … + θn*xn

Interpretation

What this means is: If value from logistic function > 0.5: Class of input is 1 If value from logistic function < 0.5: Class of input is 0 Ref: stanford.edu
Tags: Machine Learning,Mathematical Foundations for Data Science,

Index of Quizzes (Educational)


  1. Try Out Machine Learning and Data Science Quiz Questions With Solutions
  2. Show All Interview Questions (For ML, NLP, Deep Learning)
  3. Hindi to English Learning (Version 3)
  4. Progress Report (Hindi to English Learning)
  5. Python Quiz (13 Questions, May 2023)
  6. LinkedIn's HTML Assessment Dump (Apr 2023)
  7. React Based Quiz App - Questions on JS
  8. Machine Learning Quiz (For Beginners)
  9. 20 Quiz Questions For JavaScript Beginners with Easy Difficulty (Oct 2023)
  10. Regular Expressions Quiz (12 Questions)
  11. 14 Problems on lists in Python
  12. 5 Problems on strings (Using Python)
Tags: Technology,JavaScript,Machine Learning,Deep Learning,

Sunday, July 28, 2024

List of Biographies and Autobiographies (Jul 2024)

Download Books
Tags: Biography,List of Books,Book Summary,

Saturday, July 27, 2024

Resilience and Wabi-Sabi

How to face life's challenges without letting stress and worry age you

What is resilience?

One thing that everyone with a clearly defined ikigai has in common is that they pursue their passion no matter what. They never give up, even when the cards seem stacked against them or they face one hurdle after another. We're talking about resilience, a concept that has become influential among psychologists. But resilience isn't just the ability to persevere. As we'll see in this chapter, it is also an outlook we can cultivate to stay focused on the important things in life rather than what is most urgent, and to keep ourselves from being carried away by negative emotions. In the final section of the chapter, we'll explore techniques that go beyond resilience to cultivate antifragility. Sooner or later, we all have to face difficult moments, and the way we do this can make a huge difference to our quality of life. Proper training for our mind, body, and emotional resilience is essential for confronting life's ups and downs. 七転び八起き Nana korobi ya oki Fall seven times, rise eight. —Japanese proverb Resilience is our ability to deal with setbacks. The more resilient we are, the easier it will be to pick ourselves up and get back to what gives meaning to our lives. Resilient people know how to stay focused on their objectives, on what matters, without giving in to discouragement. Their flexibility is the source of their strength: They know how to adapt to change and to reversals of fortune. They concentrate on the things they can control and don't worry about those they can't. In the words of the famous Serenity Prayer by Reinhold Niebuhr: God, give us grace to accept with serenity the things that cannot be changed, Courage to change the things which should be changed, and the Wisdom to distinguish the one from the other.

Emotional resilience through Buddhism and Stoicism

Siddhārtha Gautama (Buddha) was born a prince of Kapilavastu, Nepal, and grew up in a palace, surrounded by riches. At sixteen he married and had a child. Not satisfied by his family's wealth, at twenty-nine he decided to try a different lifestyle and ran away from the palace to live as an ascetic. But it wasn't asceticism that he was looking for; it didn't offer the happiness and well-being he sought. Neither wealth nor extreme asceticism worked for him. He realized that a wise person should not ignore life's pleasures. A wise person can live with these pleasures but should always remain conscious of how easy it is to be enslaved by them. Zeno of Citium began his studies with the Cynics. The Cynics also led ascetic lives, leaving behind all earthly pleasures. They lived in the street, and the only thing they owned was the clothing on their backs. Seeing that Cynicism did not give him a sense of well-being, Zeno abandoned its teachings to found the school of Stoicism, which centers on the idea that there is nothing wrong with enjoying life's pleasures as long as they do not take control of your life as you enjoy them. You have to be prepared for those pleasures to disappear. The goal is not to eliminate all feelings and pleasures from our lives, as in Cynicism, but to eliminate negative emotions. Since their inception, one of the objectives of both Buddhism and Stoicism has been to control pleasure, emotions, and desires. Though the philosophies are very different, both aim to curb our ego and control our negative emotions. Both Stoicism and Buddhism are, at their roots, methods for practicing well-being. According to Stoicism, our pleasures and desires are not the problem. We can enjoy them as long as they don't take control of us. The Stoics viewed those who were able to control their emotions as virtuous.

What's the worst thing that could happen?

We finally land our dream job, but after a little while we are already hunting for a better one. We win the lottery and buy a nice car but then decide we can't live without a sailboat. We finally win the heart of the man or woman we've been pining for and suddenly find we have a wandering eye. People can be insatiable. The Stoics believed that these kinds of desires and ambitions are not worth pursuing. The objective of the virtuous person is to reach a state of tranquility (apatheia): the absence of negative feelings such as anxiety, fear, shame, vanity, and anger, and the presence of positive feelings such as happiness, love, serenity, and gratitude. In order to keep their minds virtuous, the Stoics practiced something like negative visualization: They imagined the worst thing that could happen in order to be prepared if certain privileges and pleasures were taken from them. To practice negative visualization, we have to reflect on negative events, but without worrying about them. Seneca, one of the richest men in ancient Rome, lived a life of luxury but was, nonetheless, an active Stoic. He recommended practicing negative visualization every night before falling asleep. In fact, he not only imagined these negative situations, he actually put them into practice—for example, by living for a week without servants, or the food and drink he was used to as a wealthy man. As a result, he was able to answer the question “What's the worst thing that could happen?”

Meditating for healthier emotions

In addition to negative visualization and not giving in to negative emotions, another central tenet of Stoicism is knowing what we can control and what we can't, as we see in the Serenity Prayer. Worrying about things that are beyond our control accomplishes nothing. We should have a clear sense of what we can change and what we can't, which in turn will allow us to resist giving in to negative emotions. In the words of Epictetus, “It's not what happens to you, but how you react that matters.” In Zen Buddhism, meditation is a way to become aware of our desires and emotions and thereby free ourselves from them. It is not simply a question of keeping the mind free of thoughts but instead involves observing our thoughts and emotions as they appear, without getting carried away by them. In this way, we train our minds not to get swept up in anger, jealousy, or resentment. One of the most commonly used mantras in Buddhism focuses on controlling negative emotions: “Oṃ maṇi padme hūṃ ,” in which oṃ is the generosity that purifies the ego, ma is the ethics that purifies jealousy, ṇi is the patience that purifies passion and desire, pad is the precision that purifies bias, me is the surrender that purifies greed, and hūṃ is the wisdom that purifies hatred.

The here and now, and the impermanence of things

Another key to cultivating resilience is knowing in which time to live. Both Buddhism and Stoicism remind us that the present is all that exists, and it is the only thing we can control. Instead of worrying about the past or the future, we should appreciate things just as they are in the moment, in the now. “The only moment in which you can be truly alive is the present moment,” observes the Buddhist monk Thich Nhat Hanh. In addition to living in the here and now, the Stoics recommend reflecting on the impermanence of the things around us. The Roman emperor Marcus Aurelius said that the things we love are like the leaves of a tree: They can fall at any moment with a gust of wind. He also said that changes in the world around us are not accidental but rather form part of the essence of the universe—a rather Buddhist notion, in fact. We should never forget that everything we have and all the people we love will disappear at some point. This is something we should keep in mind, but without giving in to pessimism. Being aware of the impermanence of things does not have to make us sad; it should help us love the present moment and those who surround us. “All things human are short-lived and perishable,” Seneca tells us. The temporary, ephemeral, and impermanent nature of the world is central to every Buddhist discipline. Keeping this always in mind helps us avoid excessive pain in times of loss.

Wabi-sabi and ichi-go ichi-e

Wabi-sabi is a Japanese concept that shows us the beauty of the fleeting, changeable, and imperfect nature of the world around us. Instead of searching for beauty in perfection, we should look for it in things that are flawed, incomplete. This is why the Japanese place such value, for example, on an irregular or cracked teacup. Only things that are imperfect, incomplete, and ephemeral can truly be beautiful, because only those things resemble the natural world. A complementary Japanese concept is that of ichi-go ichi-e, which could be translated as “This moment exists only now and won't come again.” It is heard most often in social gatherings as a reminder that each encounter— whether with friends, family, or strangers—is unique and will never be repeated, meaning that we should enjoy the moment and not lose ourselves in worries about the past or the future. The concept is commonly used in tea ceremonies, Zen meditation, and Japanese martial arts, all of which place emphasis on being present in the moment. In the West, we've grown accustomed to the permanence of the stone buildings and cathedrals of Europe, which sometimes gives us the sense that nothing changes, making us forget about the passage of time. Greco-Roman architecture adores symmetry, sharp lines, imposing facades, and buildings and statues of the gods that outlast the centuries. Japanese architecture, on the other hand, doesn't try to be imposing or perfect, because it is built in the spirit of wabi-sabi. The tradition of makingstructures out of wood presupposes their impermanence and the need for future generations to rebuild them. Japanese culture accepts the fleeting nature of the human being and everything we create. The Grand Shrine of Ise,3 for example, has been rebuilt every twenty years for centuries. The most important thing is not to keep the building standing for generations, but to preserve customs and traditions—things that can withstand the passage of time better than structures made by human hands. The key is to accept that there are certain things over which we have no control, like the passage of time and the ephemeral nature of the world around us. Ichi-go ichi-e teaches us to focus on the present and enjoy each moment that life brings us. This is why it is so important to find and pursue our ikigai. Wabi-sabi teaches us to appreciate the beauty of imperfection as an opportunity for growth.

Beyond resilience: Antifragility

As the legend goes, the first time Hercules faced the Hydra, he despaired when he discovered that cutting off one of its heads meant that two would grow back in its place. He would never be able to kill the beast if it got stronger with every wound. As Nassim Nicholas Taleb explains in Antifragile: Things That Gain from Disorder,4 we use the word fragile to describe people, things, and organizations that are weakened when harmed, and the words robust and resilient for things that are able to withstand harm without weakening, but we don't have a word for things that get stronger when harmed (up to a point). To refer to the kind of power possessed by the Hydra of Lerna, to talk about things that get stronger when they are harmed, Taleb proposes the term antifragile: “Antifragility is beyond resilience or robustness. The resilient resists shocks and stays the same; the antifragile gets better.” Catastrophes and exceptional circumstances offer good models for explaining antifragility. In 2011 a tsunami hit the Tōhoku region of Japan, doing tremendous damage to dozens of cities and towns along the coast, most famously Fukushima. When we visited the affected coast two years after the catastrophe, having driven for hours along cracked highways and past one empty gas station after another, we passed through several ghost towns whose streets had been taken over by the remnants of houses, piles of cars, and empty train stations. These towns were fragile spaces that had been forgotten by the government and could not recover on their own. Other places, such as Ishinomaki and Kesennuma, suffered extensive damage but were rebuilt within a few years, thanks to the efforts of many. Ishinomaki and Kesennuma showed how resilient they were in their ability to return to normal after the catastrophe. The earthquake that caused the tsunami also affected the Fukushima nuclear power plant. The Tokyo Electric Power Company engineers working at the plant were not prepared to recover from that kind of damage. The Fukushima nuclear facility is still in a state of emergency and will be for decades to come. It demonstrated its fragility in the face of an unprecedented catastrophe. The Japanese financial markets closed minutes after the earthquake. Which businesses did the best in the aftermath? Stock in big construction companies has been steadily on the rise since 2011; the need to rebuild the entire coast of Tōhoku is a boon for construction. In this case, Japanese construction companies are antifragile, since they benefited enormously from the catastrophe. Now let's take a look at how we can apply this concept to our daily lives. How can we be more antifragile?

Step 1: Create redundancies

Instead of having a single salary, try to find a way to make money from your hobbies, at other jobs, or by starting your own business. If you have only one salary, you might be left with nothing should your employer run into trouble, leaving you in a position of fragility. On the other hand, if you have several options and you lose your primary job, it might just happen that you end up dedicating more time to your secondary job, and maybe even make moremoney at it. You would have beaten that stroke of bad luck and would be, in that case, antifragile. One hundred percent of the seniors we interviewed in Ogimi had a primary and a secondary occupation. Most of them kept a vegetable garden as a secondary job, and sold their produce at the local market. The same idea goes for friendships and personal interests. It's just a matter, as the saying goes, of not putting all your eggs in one basket. In the sphere of romantic relationships, there are those who focus all their energy on their partner and make him or her their whole world. Those people lose everything if the relationship doesn't work out, whereas if they've cultivated strong friendships and a full life along the way, they'll be in a better position to move on at the end of a relationship. They'll be antifragile. Right now you might be thinking, “I don't need more than one salary, and I'm happy with the friends I've always had. Why should I add anything new?” It might seem like a waste of time to add variation to our lives, because extraordinary things don't ordinarily happen. We slip into a comfort zone. But the unexpected always happens, sooner or later.

Step 2: Bet conservatively in certain areas and take many small risks in others

The world of finance turns out to be very useful in explaining this concept. If you have $10,000 saved up, you might put $9,000 of that into an index fund or fixed-term deposit, and invest the remaining $1,000 in ten start-ups with huge growth potential—say, $100 in each. One possible scenario is that three of the companies fail (you lose $300), the value of three other companies goes down (you lose another $100 or $200), the value of three goes up (you make $100 or $200), and the value of one of the start-ups increases twenty-fold (you make nearly $2,000, or maybe even more). You still make money, even if three of the businesses go completely belly- up. You've benefited from the damage, just like the Hydra. The key to becoming antifragile is taking on small risks that might lead to great reward, without exposing ourselves to dangers that might sink us, such as investing $10,000 in a fund of questionable reputation that we saw advertised in the newspaper.

Step 3: Get rid of the things that make you fragile

We're taking the negative route for this exercise. Ask yourself: What makes me fragile? Certain people, things, and habits generate losses for us and make us vulnerable. Who and what are they? When we make our New Year's resolutions, we tend to emphasize adding new challenges to our lives. It's great to have this kind of objective, but setting “good riddance” goals can have an even bigger impact. For example: # Stop snacking between meals # Eat sweets only once a week # Gradually pay off all debt # Avoid spending time with toxic people # Avoid spending time doing things we don't enjoy, simply because we feel obligated to do them # Spend no more than twenty minutes on Facebook per day To build resilience into our lives, we shouldn't fear adversity, because each setback is an opportunity for growth. If we adopt an antifragile attitude, we'll find a way to get stronger with every blow, refining our lifestyle and staying focused on our ikigai. Taking a hit or two can be viewed as either a misfortune or an experience that we can apply to all areas of our lives, as we continually make corrections and set new and better goals. As Taleb writes in Antifragile, “We need randomness, mess, adventures, uncertainty, self-discovery, hear traumatic episodes, all these things that make life worth living.” We encourage those interested in the concept of antifragility to read Nassim Nicholas Taleb's Antifragile. Life is pure imperfection, as the philosophy of wabi-sabi teaches us, and the passage of time shows us that everything is fleeting, but if you have a clear sense of your ikigai, each moment will hold so many possibilities that it will seem almost like an eternity.

Source: Chapter 9 from the book "Ikigai" by Hector Garcia

Tags: Book Summary,Emotional Intelligence,Buddhism,

Thursday, July 25, 2024

React Native Books (Jul 2024)

To See All Tech Related Book Lists: Index of Book Lists And Downloads
Download Books
1.
Learning React Native: Building Native Mobile Apps with JavaScript
Bonnie Eisenman, 2015

2.
React Native in Action: Developing IOS and Android Apps with JavaScript
Nader Dabit, 2019

3.
React and React Native
Adam Boduch, 2017

4.
Fullstack React Native: Create Beautiful Mobile Apps with JavaScript and React Native
Anthony Accomazzo, 2019

5.
React Native for Mobile Development: Harness the Power of React Native to Create Stunning IOS and Android Applications
Abhishek Nalwaya, 2019

6.
React and React Native: A Complete Hands-on Guide to Modern Web and Mobile Development with React.js
Adam Boduch, 2020

7.
React Native Cookbook: Recipes for Solving Common React Native Development Problems
Dan Ward, 2019

8.
Mastering React Native: A Beginner's Guide
2022

9.
Professional React Native: Expert Techniques and Solutions for Building High-quality, Cross-platform, Production-ready Apps
Alexander Benedikt Kuttig, 2022

10.
React and React Native: Build Cross-platform JavaScript Applications with Native Power for the Web, Desktop, and Mobile
Adam Boduch, 2022

11.
Simplifying State Management in React Native: Master State Management from Hooks and Context Through to Redux, MobX, XState, Jotai and React Query
Aleksandra Desmurs-Linczewska, 2023

12.
JavaScript Everywhere: Building Cross-Platform Applications with GraphQL, React, React Native, and Electron
Adam D. Scott, 2020

13.
Practical React Native: Build Two Full Projects and One Full Game Using React Native
Frank Zammetti, 2018

14.
Mastering React Native
Cybellium Ltd

15.
React Native for IOS Development
Abhishek Nalwaya, 2015

16.
Learning React: Modern Patterns for Developing React Apps
Alex Banks, 2020

17.
React: Cross-Platform Application Development with React Native: Build 4 Real-world Apps with React Native
Emilio Rodriguez Martinez, 2018

18.
React Native By Example
Richard Kho, 2017

19.
React Native Cookbook: Bringing the Web to Native Platforms
Jonathan Lebensold, 2018

20.
React Key Concepts: Consolidate Your Knowledge of React's Core Features
Maximilian Schwarzmuller, 2022

21.
Hands-On Design Patterns with React Native: Proven Techniques and Patterns for Efficient Native Mobile Development with JavaScript
Mateusz Grzesiukiewicz, 2018

22.
React in Action
Mark Tielens Thomas, 2018

23.
React: Up & Running: Building Web Applications
Stoyan Stefanov, 2016

24.
Beginning React with Hooks
Greg Lim, 2020

25.
React Design Patterns and Best Practices
Michele Bertoli, 2017

26.
Mastering React Native
Eric Masiello, 2017

27.
React Native Cookbook
Stan Bershadskiy, 2016

28.
Beginning React (incl. Redux and React Hooks)
Greg Lim, 2017

29.
The Road to Learn React: Your Journey to Master Plain Yet Pragmatic React. Js
Robin Wieruch, 2017

30.
React Native - Building Mobile Apps with JavaScript
Vladimir Novick, 2017

31.
React Native Blueprints: Create Eight Exciting Native Cross-platform Mobile Applications with JavaScript
Emilio Rodriguez Martinez, 2017

32.
Learn All about React Native
Innoware Pjp, 2023

33.
Creating Apps with React Native: Deliver Cross-Platform 0 Crash, 5 Star Apps
M. Holmes He, 2022

34.
React Native Tutorial: How to Start with React Native. Beginners Guide Book
Nicholas Brown, 2016

35.
React: Quickstart Step-By-Step Guide to Learning React Javascript Library (React. Js, Reactjs, Learning React JS, React Javascript, React Programming)
Lionel Lopez, 2017

36.
React Quickly: Painless Web Apps with React, JSX, Redux, and GraphQL
Azat Mardan, 2017

37.
React Cookbook: Create Dynamic Web Apps with React Using Redux, Webpack, Node.js, and GraphQL
Carlos Santana Roldán, 2018

38.
React Design Patterns and Best Practices: Design, Build and Deploy Production-ready Web Applications Using Standard Industry Practices, 2nd Edition
Carlos Santana Roldán, 2019

39.
Beginning ReactJS Foundations Building User Interfaces with ReactJS: An Approachable Guide
Chris Minnick, 2022

40.
Lightning-Fast Mobile App Development with Galio: Build Stylish Cross-platform Mobile Apps with Galio and React Native
Alin Gheorghe, 2021

41.
The Road to React: With React 18 and React Hooks : Required Knowledge: JavaScript
Robin Wieruch, 2017

42.
Getting Started with React Native
Tom Bray, 2015

43.
Learning React: Functional Web Development with React and Redux
Alex Banks, 2017

44.
Fullstack React: The Complete Guide to ReactJS and Friends
Nate Murray, 2017

45.
Learning React: A Hands-On Guide to Building Web Applications Using React and Redux
Kirupa Chinnathambi, 2017

46.
Pro React 16
Adam Freeman, 2019

47.
Getting Started with React
Danillo Corvalan, 2016

48.
React Development Using TypeScript: Modern Web App Development Using Advanced React Techniques (English Edition)
Pranali Dahale, 2024

49.
React Projects: Build Advanced Cross-platform Projects with React and React Native to Become a Professional Developer
Roy Derks, 2022

50.
React Native for Mobile Development (2 in 1 eBooks)
2023
Tags: Technology,List of Books,JavaScript,React Native,