:open_book: Day 41 of 100daysofcode challenge: MVC Architecture

MVC stands for Model-View-Controller, a software architectural pattern that separates an application into three interconnected components. This pattern helps developers create modular, maintainable, and scalable applications.

:star2:Components:

:small_orange_diamond:Model: The Model represents the data and business logic of the application. It’s responsible for managing the data, performing calculations, and enforcing business rules.

:small_orange_diamond:View:The View is responsible for rendering the user interface (UI) of the application. It receives data from the Model and displays it to the user in a format that’s easy to understand.

:small_orange_diamond:Controller: The Controller acts as an intermediary between the Model and View. It receives user input, communicates with the Model to perform actions, and updates the View accordingly.

2 Likes

:open_book: Day 42 of 100daysofcode challenge: DevOps

In order to understand MLOps better, I feel that it is important to understand DevOps as well since MLOps is derived from DevOps.

:thinking: What is DevOps? :thinking:

DevOps is a set of practices that combines software development (Dev) and IT operations (Ops) to work in unison with improved speed, quality and reliability of software releases and development. These two teams (Dev team and Ops team) were somewhat at odds with each other since they had conflicted goals. Dev team wanted to improve and fix the features of a product while The Ops team wanted the product to stay stable at all times. DevOps aims to bridge the gap between the two teams and create a culture of collaboration, automation and continuous improvement.

:star: The DevOps Cycle:

The DevOps cycle is a continuous loop. each stage informs and improves the previous one. The cycle repeats as new requirements emerge, and the application evolves to meet changing user needs and market demands.

2 Likes

:open_book: Day 43 of 100daysofcode challenge: Informed search algorithms

:thinking:What is an Informed Search Algorithm?:thinking:

An informed search algorithm is a type of search algorithm that uses additional information about the problem domain to guide the search towards more promising areas of the search space. This additional information is usually in the form of heuristics, which are estimates of the distance from a node to the goal state.

:exclamation::exclamation:Informed search algorithms are more efficient than uninformed search algorithms because they use this additional information to focus the search on the most promising areas of the search space, reducing the number of nodes that need to be explored.

:star2:Examples of types of Informed Search Algorithms:

:small_orange_diamond:Best-First Search (Greedy Search):Expands the node that is closest to the goal state according to the heuristic function.
:exclamation:Uses a priority queue data structure to keep track of nodes to visit.

:small_orange_diamond:A star (*) Search:A variant of best-first search that uses an admissible heuristic function to guide the search.
:exclamation: Guarantees to find the shortest path to the goal state if the heuristic function is admissible and consistent.

:small_orange_diamond:Hill Climbing Search:Starts with an initial solution and iteratively applies small changes to find a better solution.
:exclamation:Uses a heuristic function to evaluate the quality of each solution.

2 Likes

:open_book: Day 44 of 100daysofcode challenge: Knowledge-Based Agents

:thinking:What is a Knowledge-Based Agent?:thinking:

A knowledge-based agent is a type of artificial intelligence (AI) that uses knowledge to reason, make decisions, and take actions. It’s a software program that mimics human-like intelligence by using a knowledge base to guide its behavior.

:star2:Characteristics of Knowledge-Based Agents:

:small_orange_diamond:Knowledge Representation: A knowledge-based agent represents knowledge in a structured and organized way, using formats like rules, frames, or semantic networks.

:small_orange_diamond:Reasoning and Inference:The agent uses reasoning and inference techniques to draw conclusions from the knowledge base, making it possible to make decisions and take actions.

:small_orange_diamond:Knowledge Acquisition:The agent can acquire new knowledge through various means, such as learning from experience, being told by humans, or extracting information from data.

:small_orange_diamond:Context-Aware:Knowledge-based agents can understand the context in which they operate, allowing them to adapt to changing situations.

:star2:Types of Knowledge-Based Agents:

:small_orange_diamond:Simple Reflex Agent: Reacts to the current state of the environment without considering future consequences.

:small_orange_diamond:Model-Based Reflex Agent: Maintains an internal model of the environment and uses this model to make decisions.

:small_orange_diamond:Goal-Based Agent:Has specific goals and uses planning and decision-making to achieve those goals.

:small_orange_diamond:Unity-Based Agent:Combines multiple agents to achieve a common goal.

2 Likes

:open_book: Day 45 of 100daysofcode challenge: Propositional Logic

:thinking:What is Propositional Logic?:thinking:

Propositional logic is a branch of logic that deals with statements that can be either true or false. It involves using logical operators to combine these statements and form new ones, allowing us to reason about the truth of these statements.

:star2:Key Concepts:

:small_orange_diamond:Propositions:Statements that can be either true or false, denoted by capital letters (example: P, Q, R).
:small_orange_diamond:Logical Operators: Symbols used to combine propositions, including:

  • ¬ (NOT): negation, indicating the opposite of a proposition
  • ∧ (AND): conjunction, indicating both propositions are true
  • ∨ (OR): disjunction, indicating at least one proposition is true
  • → (IMPLIES): implication, indicating one proposition implies another
  • (IFF): if and only if, indicating two propositions are equivalent
    :small_orange_diamond:Truth Tables:A table used to visualize the possible combinations of truth values for propositions and their corresponding outcomes.
    :small_orange_diamond:Tautologies: Statements that are always true, regardless of the truth values of the propositions.
    :small_orange_diamond:Contradictions:Statements that are always false, regardless of the truth values of the propositions.
2 Likes

:open_book: Day 46 of 100daysofcode challenge: Power BI and data analysis

Today I spent my morning joining a workshop hosted by Khwarizme s.a.r.l. Through this workshop I got an introductory lecture about data analysis and learned the ins and outs of Power BI ; a software Microsoft tool that is used to visualizing and analyzing data in a clear and concise dashboard. Power BI accepts any kind of database whether it’s from SQL, excel or MongoDB

I learned about the phases of data analysis(ask,prepare,process,analyse,share,act), the ETL process (Extract,transform,load) , the difference between Import mode and direct query mode, Data modeling and DAX (Data Analysis Expression)

All in all, the workshop was very informative and fun. I would personally like to thank Sana AlGhafari for being a great tutor. I can’t wait for the next session.

2 Likes

:open_book: Day 47 of 100daysofcode challenge: Inference rules

In propostional and predicate logic, we can use inference rules to draw conclusions from given premises. These rules help make logical deductions and valid conclusions.

:star2: Example of some Inference rules:

:small_orange_diamond:Modus Ponens (MP): If we have premises ‘p’ and ‘p → q’, we can infer ‘q’ (as in ‘q’ is also true).

:small_orange_diamond:Modus Tollens (MT): If we have premises ‘p → q’ and ‘¬q’, we can infer ‘¬p’.

:small_orange_diamond:Hypothetical Syllogism (HS): If we have premises ‘p → q’ and ‘q → r’, we can infer ‘p → r’.

:small_orange_diamond:Disjunctive Syllogism (DS): If we have premises ‘p ∨ q’ and ‘¬p’, we can infer ‘q’.

:small_orange_diamond:Conjunction Introduction (CI): If we have premises ‘p’ and ‘q’, we can infer ‘p ∧ q’

1 Like

:open_book: Day 48 of 100daysofcode challenge: Continuing the Data Analysis and Power BI workshop

As of today, I have finished the “Data Analysis Power BI: from Insights to Action” 8 hour workshop and gained the certificate for it’s completion. It was a very informative experience. Again, I would like to thank Sana AlGhafari for being a great instructor. I will certainly be keeping an eye on other workshops that Khwarizme s.a.r.l will be hosting in the near future.

2 Likes

:computer: Day 49 of hashtag#100DaysOfCode challenge: Coding Practice Propositional Logic

I am currently taking CS50’s AI course. One of the lectures is about knowledge and propositional logic. With these lectures comes a bunch of coding exercises and projects to complete and submit. These projects truly help in understanding the lecture even more.

Today I completed a project that is the equivalent of a logic puzzle. The premise is that there are three persons (A,B,C) and each can be either a knight or a knave (but not both).Knights always tell the truth while knaves are liars. Using this base knowledge plus what each person says, I must construct a meaningful knowledge base where my algorithm can use this knowledge base to indicate who is a knight and who is a knave.

I find this project to be a fun and creative way to learn about propositional logic.

2 Likes

:computer: Day 50 of 100daysofcode challenge: Minesweeper AI

As part of CS50’AI course, I was tasked to code an AI for a Minesweeper game. This AI prioritizes safe moves on cells that don’t have a bomb. It uses it’s knowledge base to store all the information it knows about the game (In the form of sentences) and infers from that knowledge base which cells are safe and which have mines on them. If there are no obvious safe moves to make then the AI will do a random move (which could contain a bomb and cost the AI the game)

2 Likes

:open_book: Day 51 of 100daysofcode Challenge: Scikit-learn

Scikit-learn is an open-source library that provides a wide range of algorithms for machine learning tasks, including classification, regression, clustering, dimensionality reduction, and more. It’s built on top of popular libraries like NumPy, SciPy, and Matplotlib, making it easy to integrate with other Python data science tools.

Scikit-learn is widely used in the industry and academia for building machine learning models, and its simplicity and flexibility make it a great choice for beginners and experts alike.

2 Likes

:open_book: Day 52 of 100daysofcode challenge: Bayesian Networks

:thinking:What is a Bayesian Network?:thinking:

A Bayesian network is a probabilistic graphical model that represents a set of variables and their conditional dependencies using a directed acyclic graph (DAG). It’s a way to model complex relationships between variables, and it’s particularly useful for handling uncertainty and incomplete data.

:star2:Key Components:

:small_orange_diamond:Nodes (Variables):Representing random variables, nodes can be discrete or continuous.

:small_orange_diamond:Edges (Arrows): Directed edges connect nodes, indicating conditional dependencies between variables.

:small_orange_diamond:Conditional Probability Tables (CPTs):Associated with each node, CPTs specify the probability distribution of a node given its parent nodes.

:star2:How Bayesian Networks Work:

  1. Inference: Given evidence (observed values) for some nodes, the network propagates probabilities to compute posterior probabilities for other nodes.

  2. Conditional Independence:The graph structure encodes conditional independence assumptions, simplifying the model and reducing the number of parameters.

:star2:Types of Bayesian Networks:

:small_orange_diamond:Bayesian Belief Network (BBN):A general Bayesian network that represents a joint probability distribution over a set of variables.
:small_orange_diamond:Influence Diagram (ID): An extension of BBNs, IDs include decision nodes and utility nodes for decision-making under uncertainty.

2 Likes

:computer: Day 53 of 100daysofcode challenge: Page ranker

As part of the CS50 AI course, I was tasked to do a program that ranks the probability that a user might visit a certain page. This program shows the results of two different algorithms, a random sampling model and an iterative model. Through this exercise I managed to learn more about the Markov chains(a mathematical system which is how the random sampling model loosely operates like) and also how search engines like google shows it’s top results (how it determines which page is “important” to be put on top).

2 Likes

:computer: Day 54 of 100daysofcode challenge: AI that declares the probability of a genetic trait

Another @CS50 AI task. In this one, I have to code an AI that can declare the likelihood that a person will have a particular genetic trait. This program will have access to a family’s genetic history (the history is stored in csv tables) and through multiple calculations and algorithms will print out multiple probabilities for every family member. The gene we are observing is the GJB2 gene , but we can alter the program easily to have it track any gene we could want.

2 Likes

:open_book: Day 55 of 100daysofcode challenge: Optimization Techniques

:thinking:What are Optimization Techniques?:thinking:

Optimization techniques are methods used to find the best solution among a set of possible solutions, given a specific objective function and constraints. The goal is to maximize or minimize the objective function, subject to certain limitations or constraints.

:star2:Types of Optimization Techniques:

:small_orange_diamond:Linear Programming (LP): A method to optimize a linear objective function, subject to linear constraints.

:small_orange_diamond:Integer Programming (IP): A method to optimize an integer objective function, subject to integer constraints.

:small_orange_diamond:Non-Linear Programming (NLP): A method to optimize a non-linear objective function, subject to non-linear constraints.

:small_orange_diamond:Dynamic Programming (DP): A method to optimize a problem by breaking it down into smaller sub-problems and solving each sub-problem only once.

:small_orange_diamond:Stochastic Optimization:A method to optimize a problem involving random variables, using techniques such as simulation and probabilistic modeling.

:small_orange_diamond:Metaheuristics: High-level algorithms that use heuristics to search for good solutions, such as genetic algorithms, simulated annealing, and ant colony optimization.

:small_orange_diamond:Constraint Programming:A method to optimize a problem by modeling constraints and using specialized algorithms to find a solution that satisfies all constraints.

1 Like

:open_book: Day 56 of 100daysofcode challenge:Local Search

:thinking:What is Local Search?:thinking:

Local search is a heuristic optimization technique used to find good, but not necessarily optimal, solutions to complex problems. It’s a metaheuristic approach that iteratively explores the solution space, navigating through neighboring solutions to find better ones.

:star2:Key Components:

:small_orange_diamond:Current Solution:The current solution being evaluated.
:small_orange_diamond:Neighborhood Functions: Functions that generate neighboring solutions by applying small changes to the current solution.
:small_orange_diamond:Objective Function:The function being optimized, which evaluates the quality of each solution.
:small_orange_diamond:Termination Criteria:Conditions that stop the search, such as a maximum number of iterations or a satisfactory solution quality.

:star2:How Local Search Works:

:small_orange_diamond:Initialization:Choose an initial solution or generate one randomly.
:small_orange_diamond:Evaluation: Evaluate the current solution using the objective function.
:small_orange_diamond: Neighbor Generation: Apply the neighborhood functions to generate a set of neighboring solutions.
:small_orange_diamond: Selection: Select the best neighboring solution based on the objective function.
:small_orange_diamond: Replacement: Replace the current solution with the selected neighboring solution.
6. Iteration:Repeat steps 2-5 until the termination criteria are met.

:star2:Types of Local Search:

:small_orange_diamond:Hill Climbing: A simple local search algorithm that iteratively improves the current solution by selecting the best neighboring solution.
:small_orange_diamond:Simulated Annealing:A probabilistic local search algorithm that uses a temperature schedule to control the exploration-exploitation trade-off.
:small_orange_diamond:Tabu Search:A local search algorithm that uses memory to avoid revisiting recently explored solutions.

1 Like

:open_book: Day 57 of 100daysofcode challenge:TensorFlow

:thinking:What is TensorFlow?:thinking:

TensorFlow is an open-source software library developed by Google Brain Team in 2015. It’s primarily used for building and training artificial neural networks, particularly deep neural networks. TensorFlow allows developers to easily implement popular deep learning architectures such as convolutional neural networks (CNNs), recurrent neural networks (RNNs), and autoencoders.

:star2:Key Features:

:small_orange_diamond:Automatic Differentiation: TensorFlow can automatically compute gradients, which is useful for training neural networks.
:small_orange_diamond:Distributed Training: TensorFlow allows for distributed training of models across multiple machines, making it scalable and efficient.
:small_orange_diamond:Pre-Built Estimators:TensorFlow provides pre-built estimators for common machine learning models, making it easier to implement and train models.
:small_orange_diamond:Visualization Tools:TensorFlow provides visualization tools, such as TensorBoard, to visualize and debug machine learning models.
:small_orange_diamond:Multi-Language Support: TensorFlow supports multiple programming languages, including Python, C++, and Java.

:star2:How TensorFlow Works:

:small_orange_diamond:TensorFlow Graph: TensorFlow represents a machine learning model as a graph, comprising tensors (multidimensional arrays) and operations.
:small_orange_diamond:Session:A session is created to run the graph, which executes the operations and updates the tensors.
:small_orange_diamond:Optimizer:An optimizer is used to minimize the loss function and update the model parameters.

2 Likes

:open_book: Day 58 of 100daysofcode challenge:Hill Climbing algorithms

:thinking: What are Hill Climbing Algorithms?:thinking:

Hill climbing algorithms are a type of optimization technique used to find the maximum or minimum of a function.

:star2:How Hill Climbing Algorithms Work:

  1. Initialization:Start with an initial solution or a random point in the search space.

  2. Evaluation: Evaluate the current solution using the objective function.

  3. Neighbor Generation:Generate a set of neighboring solutions by applying small changes to the current solution.

  4. Selection:Select the best neighboring solution based on the objective function.

  5. Replacement: Replace the current solution with the selected neighboring solution.

  6. Iteration: Repeat steps 2-5 until a termination condition is met, such as a maximum number of iterations or a satisfactory solution.

:star2:Types of Hill Climbing Algorithms:

:small_orange_diamond:Simple Hill Climbing: A basic hill climbing algorithm that uses a simple way of generating neighboring solutions.
:small_orange_diamond: Steepest Ascent Hill Climbing:A variation of hill climbing that uses the steepest ascent direction to generate neighboring solutions.
:small_orange_diamond: Simulated Annealing:A probabilistic hill climbing algorithm that uses a temperature schedule to control the exploration-exploitation trade-off.
:small_orange_diamond:Iterated Local Search:A hill climbing algorithm that uses a local search to find good solutions and then iteratively applies the local search to improve the solution.

:exclamation::exclamation: While hill climbing algorithms are easy to implement, we do run the risk of find a local maximum/minimum and not the global maximum/minimum​:exclamation::exclamation:

2 Likes

:open_book: Day 59 of 100daysofcode challenge: Simulated annealing

:thinking:What is Simulated Annealing?:thinking:

Simulated annealing is a probabilistic optimization technique inspired by the process of annealing in metallurgy. It’s a metaheuristic algorithm that uses a temperature schedule to control the exploration-exploitation trade-off, allowing it to escape local optima and converge to the global optimum.

:star2: How Simulated Annealing Works:

1.Initialization:Start with an initial solution or a random point in the search space.
2. Temperature Initialization:Set an initial temperature, which controls the probability of accepting worse solutions.
3. Evaluation: Evaluate the current solution using the objective function.
4. Neighbor Generation:Generate a set of neighboring solutions by applying small changes to the current solution.
5. Probability Calculation:Calculate the probability of accepting a neighboring solution based on the temperature and the difference in objective function values.
6. Acceptance:Accept the neighboring solution with the calculated probability, or reject it and stay with the current solution.
7. Temperature Update:Update the temperature according to a cooling schedule, which controls the rate of convergence.
8. Iteration:Repeat steps 3-7 until a termination condition is met, such as a maximum number of iterations or a satisfactory solution.

:star2:Key Components:

:small_orange_diamond:Temperature Schedule: The temperature schedule controls the rate of convergence and the exploration-exploitation trade-off.
:small_orange_diamond:Probability Function:The probability function determines the likelihood of accepting a neighboring solution.
:small_orange_diamond:Cooling Rate: The cooling rate controls the rate at which the temperature decreases.

2 Likes

:open_book: Day 60 of 100daysofcode challenge: Tabu search

:thinking:What is Tabu Search?:thinking:

Tabu search is a metaheuristic optimization technique that uses a memory-based approach to avoid getting stuck in local optima. It’s a deterministic algorithm that uses a prohibition-based strategy to explore the search space efficiently.

:star2:How Tabu Search Works:

  1. Initialization:Start with an initial solution or a random point in the search space.
  2. Evaluation:*Evaluate the current solution using the objective function.
  3. Neighbor Generation: Generate a set of neighboring solutions by applying small changes to the current solution.
  4. Tabu List: Maintain a Tabu list, which stores the attributes of recently visited solutions to avoid revisiting them.
  5. Neighbor Selection:Select the best neighboring solution that is not in the Tabu list.
  6. Aspiration Criterion:Apply an aspiration criterion to allow for occasional override of the Tabu list, allowing for exploration of promising solutions.
  7. Iteration: Repeat steps 2-6 until a termination condition is met, such as a maximum number of iterations or a satisfactory solution.

:star2:Key Components:

:small_orange_diamond:Tabu List:The Tabu list stores the attributes of recently visited solutions to avoid revisiting them.
:small_orange_diamond:Tabu Size: The Tabu size determines the number of solutions stored in the Tabu list.
:small_orange_diamond:Aspiration Criterion:The aspiration criterion allows for occasional override of the Tabu list, allowing for exploration of promising solutions.

:star2:Types of Tabu Search:

:small_orange_diamond:Basic Tabu Search: A simple Tabu search algorithm that uses a fixed Tabu size and aspiration criterion.
:small_orange_diamond:Adaptive Tabu Search: A variant of Tabu search that adapts the Tabu size and aspiration criterion based on the search progress.

2 Likes