<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samiat Bola-matanmi on Medium]]></title>
        <description><![CDATA[Stories by Samiat Bola-matanmi on Medium]]></description>
        <link>https://medium.com/@sbolamatanmi?source=rss-edc69d7e8511------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DE-EMLJq9ctE_R_uLGOdMg.jpeg</url>
            <title>Stories by Samiat Bola-matanmi on Medium</title>
            <link>https://medium.com/@sbolamatanmi?source=rss-edc69d7e8511------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:35:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sbolamatanmi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Learning Statistics for Machine Learning — Part 1: Understanding Probability]]></title>
            <link>https://medium.com/@sbolamatanmi/learning-statistics-for-machine-learning-part-1-understanding-probability-75b3a9d01ba2?source=rss-edc69d7e8511------2</link>
            <guid isPermaLink="false">https://medium.com/p/75b3a9d01ba2</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Samiat Bola-matanmi]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 19:18:18 GMT</pubDate>
            <atom:updated>2026-07-09T19:18:18.470Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7TK7vI4jrhdw9OZ9SEdsQ.png" /></figure><p>When I decided to deepen my understanding of machine learning, I quickly realized that I had been relying on intuition for many concepts without fully understanding the mathematics behind them. That led me to <em>All of Statistics</em> by Larry Wasserman.</p><p>This article summarizes what I learned from the first chapter, which introduces one of the most fundamental ideas in statistics: <strong>probability</strong>.</p><p>My goal isn’t to teach statistics as an expert, but to document my learning journey in a way that might help others who are starting from the same place.</p><h3><strong>Why Do We Need Probability?</strong></h3><p>The first thing I learned is that probability is fundamentally about <strong>uncertainty</strong>. In everyday life, we constantly deal with uncertainty:<br>- Will it rain tomorrow?<br>- Will this customer default on a loan?<br>- Is this email spam?<br>- What word is someone likely to say next?</p><p>Probability gives us a mathematical language for reasoning about these uncertain events. Without probability, statistics and machine learning simply wouldn’t exist.</p><h3><strong>The Sample Space</strong></h3><p>Every probability problem begins with a <strong>sample space</strong>, usually denoted by (S). The sample space is simply the set of all possible outcomes of an experiment. For example: <br>When we roll a die the possible outcome are the numbers we are likely to roll out which is either a 1, 2, 3, 4, 5, 6. In statistics this can be written as:</p><pre>s = {1, 2, 3, 4, 5, 6} or Ω = {1, 2, 3, 4, 5, 6}</pre><p>Another example is flipping a coin we likely get a head or a tail</p><pre>s = {H, T} or Ω = {H, T}</pre><p>Every probability experiment has a sample space, which may be finite or infinite.</p><h3><strong>Events</strong></h3><p>An event is simple a subset of a sample space. Lets say we want to determine what the event of rolling a positive value is:</p><pre>Since we know that the sample space is: s = {1, 2, 3, 4, 5, 6}<br>The event of rolling a positive number is: A = {2, 4, 6}<br>The event of rolling a number greater than 4: B = {5, 6}</pre><p>Think of events as a sets and it makes life really easy.</p><h3><strong>Set Operations in Probability</strong></h3><p>One thing I appreciated about this chapter is how closely probability is connected to set theory.</p><h4><strong>Union</strong></h4><p>The union of two events is that either of the two events occur. Lets say we have event A = {1, 2, 5, 6} and event B = {1, 5, 7, 8}, then the union of these events become</p><pre>(A U B) = {1, 2, 5, 6, 7, 8}</pre><h4><strong>Intersection</strong></h4><p>This has to do with the outcomes common to both events. Lets say we have an event A = {1, 2, 3, 4} and another event B = {2, 3, 6, 7}. then the intersection of these events become</p><pre>(A ∩ B) = {2, 3}</pre><p><strong>Note: </strong>The difference between two events contains outcomes that belongs to one event and not the other event.</p><h3><strong>Conditional Probability</strong></h3><p>I found this part very interesting because it gave me insight to kow that we can also be given additional information to find a probability. Here is an example: Imagine being in your house and then you just think “whats the probability that it would rain today?” then you step outside and look at the clouds and then you see the cloud is dark then you say “ what is the probability that it would rain today given that the cloud is dark”.</p><p>This is what we call conditional probability. Learning this shifted my thinking because probability isn’t always computed in isolation. Sometimes our knowledge changes, and that changes the probability itself.</p><h3><strong>Bayes Theorem</strong></h3><p>The chapter ends with Bayes’ theorem, and at first I wondered why it was so important. What I eventually understood is that Bayes’ theorem solves a very practical problem. Often we know that if a particular cause is true how likely are we to observe some evidence.<br>For example:<br>- If someone has malaria, how likely is a positive test?. <br>- If an email is spam, how likely is it to contain the word “free”?</p><p>However, in practice we usually want to answer the reverse question.<br>- Given a positive test, how likely is it that the person has malaria?<br>- Given the word “free”, how likely is the email to be spam?</p><p>Bayes’ theorem provides the mathematical bridge that allows us to reverse the direction of conditioning and update our beliefs after observing new evidence.</p><p>This was my biggest takeaway from the chapter.</p><p>Bayes theorem can be written mathematically as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/0*mCRxC2h_U3Fthptg.png" /></figure><p>where:<br>- P(A|B) : <strong>Posterior probability</strong>: the probability of event A after observing event B.<br>- P(B|A): <strong>Likelihood</strong>: the probability of observing B assuming A is true.<br>- P(A): <strong>Prior probability</strong>: your belief about A before observing B.<br>- P(B): <strong>Evidence</strong> (or marginal likelihood): the overall probability of observing B.</p><p>A medical example: Suppose A= “Patient has malaria” and B = “Malaria test is positive”</p><p>Then Bayes theorem becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*MMrzAQGEOZbehqOS.png" /></figure><p>This says:<br>The probability that a patient has malaria given a positive test equals the probability of getting a positive test if the patient has malaria, multiplied by the prior probability of malaria, divided by the overall probability of getting a positive test.</p><p>One thing that helped me understand Bayes’ theorem was realizing that it is <strong>not creating a new probability</strong>. It is <strong>reversing the direction of a conditional probability</strong>:<br>- We often know P(B|A) If the cause is true, what evidence would I see?<br>- We want: P(A|B) Given the evidence, what is the most likely cause?</p><p>That reversal is exactly what Bayes’ theorem accomplishes.</p><h3><strong>The Bigger Picture</strong></h3><p>After finishing Chapter 1, something finally clicked. Probability isn’t just about assigning numbers to events. It’s about describing uncertainty in a mathematically consistent way. Statistics then builds on probability by asking the opposite kind of question.</p><p><strong><em>Instead of asking:</em></strong><br>“If I know the model, what data should I expect?”</p><p><strong><em>statistics asks:</em></strong><br>“I’ve observed some data. What does that tell me about the model?”</p><p>“I’ve observed some data. What does that tell me about the model?”</p><h3><strong>Final thoughts</strong></h3><p>This first chapter gave me a much stronger foundation than I expected.<br>I came into it thinking probability was mainly about coins and dice.<br>I left realizing that it is the language we use to reason under uncertainty, and that virtually every machine learning algorithm depends on these ideas in one way or another. My biggest takeaway wasn’t a formula it was a new way of thinking. Every time we observe new information, our beliefs should change, and probability gives us the mathematical tools to update those beliefs correctly. This is only Chapter 1, but I already feel like I’m beginning to understand the foundations that modern machine learning is built upon.If you’re also working through <em>All of Statistics</em>, I’d love to hear what stood out to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75b3a9d01ba2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracking the code: A Beginner’s guide to Machine Learning Through Car Price Prediction.]]></title>
            <link>https://medium.com/@sbolamatanmi/cracking-the-code-a-beginners-guide-to-machine-learning-through-car-price-prediction-62b443ebb525?source=rss-edc69d7e8511------2</link>
            <guid isPermaLink="false">https://medium.com/p/62b443ebb525</guid>
            <dc:creator><![CDATA[Samiat Bola-matanmi]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 12:28:26 GMT</pubDate>
            <atom:updated>2024-04-23T12:28:26.999Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*853oo_I5a2XTfc25ouMz9Q.jpeg" /></figure><p>Imagine a scenario where you want to buy a new car, you know what features you want for your new car such as horsepower, speed, torque etc, but you don’t have a price estimate of how much such a car would cost and you want to prevent going to the store and be shocked by prices, well this is where you can consider <strong>machine learning.</strong></p><p><strong>What is machine learning?</strong></p><p>I am sure you have heard a lot of people talking about machine learning well I would provide a simple definition <em>“Machine learning is the ability of computers to learn from data.” </em>Using our scenario above, we would have series of data with different car features and their corresponding price and train a computer to be able to predict the price based on these features such that when another set of features are given to it, it can then provide a price estimate. The next question that is probably pooping up in your head is if I’m building this how do I go about it? Well, that’s why I created this so let&#39;s dig in.</p><p>Here is a basic flow diagram for building a machine learning model and we would be following this flow in this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*hfKzYzOmKXFrgGArr68Olw.jpeg" /></figure><p>Now that we have seen what machine learning is and the basic flow of building a machine learning model, let’s explain this flow by building a car price prediction model.</p><p><strong>Note: we would not be looking at the last part in the post for simplicity.</strong></p><p><strong>Understanding the problem: </strong>Before building a machine learning model, you need to understand the problem you are trying to solve. In this case, we are trying to predict the price of a car with certain features i.e. we would have a number of features and based on those features, we would want to predict the price of the car. This understanding helps to set the objective of the project which in this case is “<em>predict the price of a car</em>”.</p><p><strong>Generate data: </strong>After the problem has been properly understood, we then proceed to generate the data need to solve the problem. In the car price prediction, the dataset we would be using is the <a href="https://www.kaggle.com/datasets/mayankpatel14/second-hand-used-cars-data-set-linear-regression"><em>second-hand cars dataset</em></a> from Kaggle. If it were to be a scenario where no dataset was available, we would probably go around getting features of cars and their prices.</p><p><strong>Process data: </strong>Processing the dataset involves several steps such a loading the data, cleaning the data etc. For this project we would be using the python programming language. Now that we have our data, the first thing is to load or read our data so as to see what its looks like. We would not be doing data cleaning in this because the data has already been cleaned.</p><p>Firstly, we need to import all necessary libraries for this project.</p><pre>import pandas as pd<br>import tensorflow as tf<br>import numpy as np<br>import keras<br>from keras.optimizers import Adam<br>from keras.losses import MeanAbsoluteError<br>from keras.metrics import RootMeanSquaredError</pre><pre>data = pd.read_csv(&quot;/Users/sammyheart/Documents/personal/new_car_prediction/dataset/train.csv&quot;)<br>data.head()</pre><p>In the above code we are using a python library called <em>pandas </em>to load our dataset. The dataset file is a csv (Comma Separated Values) file and the padas library has a method called <em>read_csv </em>which helps to read csv files. The<em> head ()</em> function is used to show the first five rows of data in our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-MTfV3SBHIqbQv86dLKOuw.png" /><figcaption>Sample of the dataset.</figcaption></figure><p>from the above image, we can see some information about our dataset such as number of columns which is 12 columns. We also have to know the number of rows we have; we use the below code to get the number of rows and columns of our dataset.</p><pre>data.shape<br>(1000, 12)</pre><p>The shape function tells us the number of rows and columns we have in our dataset as we can see it returns (1000, 12). You would be wondering 🤔 what does this then mean? Well, let me break it down. we have 1000 rows meaning the number of samples in the dataset is 1000 i.e. we have 1000 entries in our dataset, and we have 12 columns meaning we have 12 features in the dataset.</p><p>To build this model, we are using a machine learning framework called <strong>TensorFlow,</strong> so we would be converting all our data into tensors and casting them to the type of float32.</p><pre>tensor_data = tf.constant(data)<br>tensor_data = tf.cast(tensor_data, dtype=tf.float32)</pre><p>Now at this point, from our dataset, we want to train our model in such a way that we pass <strong>features,</strong> and it predicts a <strong>label. </strong>Then the<strong> </strong>question we ask ourselves is “<em>what would be the features and what would be the label and where would the come from?</em>” Well don’t be surprised they would come from our dataset. Remember we have 12 columns from those 12 columns comes our <strong>features</strong> and <strong>labels. </strong>We would be using 8 columns as features from the <em>years column to the torque column </em>and the <em>current price</em> column would serve as our label column.</p><pre>X = tensor_data[:, 3:-1]<br>print(X.shape)<br><br>y = tensor_data[:, -1]<br>y = tf.expand_dims(y, axis=-1)<br>print(y.shape)</pre><p>When planning to train a machine learning model, it is good practise to have a set of data to validate and test the dataset on so therefore we split the dataset into <em>train, validation</em> and <em>test. </em>The train data is going to be used to train the model the validation to validate the model while training and the test to test the model after training is done.</p><pre>train_ratio = 0.8<br>val_ratio = 0.1<br>test_ratio = 0.1<br>dataset_size = len(X)</pre><p>Here we are defining the ratio at which our dataset would be divided, and we are using an 80% of the dataset for training, 10% for validation and 10% for testing.</p><pre>x_train = X[:int(dataset_size * train_ratio)]<br>y_train = y[:int(dataset_size * train_ratio)]<br><br>x_val = X[int(dataset_size * train_ratio): int(dataset_size * (train_ratio + val_ratio))]<br>y_val = y[int(dataset_size * train_ratio): int(dataset_size * (train_ratio + val_ratio))]<br><br>x_test = X[int(dataset_size * (train_ratio + val_ratio)):]<br>y_test = y[int(dataset_size * (train_ratio + val_ratio)):]<br><br>print(x_train.shape)<br>print(y_train.shape)</pre><p>Now we have successfully divided the dataset into train, validation and test. We can use the <a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset"><em>tf.data.Dataset.from_tensor_slices() </em></a>to create our dataset. <em>You would be thinking what is the benefit of using this function? does it affect the model&#39;s performance at all? </em>The answer is no it does not affect the model&#39;s performance it just helps us to simplify the process of creating a dataset from tensors especially when using large datasets. We can then finally create our train, validation and test dataset.</p><pre>train_dataset = tf.data.Dataset.from_tensor_slices((x_train, y_train))<br>train_dataset = train_dataset.shuffle(buffer_size=8, reshuffle_each_iteration=True).batch(32).prefetch(tf.data.AUTOTUNE)<br><br>validation_dataset = tf.data.Dataset.from_tensor_slices((x_val, y_val)).shuffle(buffer_size=8).batch(32).prefetch(tf.data.AUTOTUNE)<br><br>test_dataset = tf.data.Dataset.from_tensor_slices((x_test, y_test)).shuffle(buffer_size=8).batch(32).prefetch(tf.data.AUTOTUNE)<br></pre><p><strong>Build model: </strong>After creating our dataset, the next step is to create our model that we want to train. In TensorFlow, there are three ways to create a model namely Sequential API, Functional API, and Subclassing method. In this post we would be using the Sequential API.</p><pre>model = keras.Sequential([<br>    InputLayer(shape=(8,)),<br>    normalizer,<br>    Dense(128, activation=&#39;relu&#39;),<br>    Dense(128, activation=&#39;relu&#39;),<br>    Dense(128, activation=&#39;relu&#39;),<br>    Dense(1)<br>])<br>model.summary()</pre><p>Here we call the Sequential API from keras. Ou model consists of one input layer, one normalizing layer, three Dense layers (serves as hidden layers) and one output layer. We use one output because we are predicting just one thing which is “<em>price of car</em>”.</p><p><strong>Train model: </strong>Till this point, we have created our dataset, built our model, now it’s time to train the model. In training the model, we now want the model we built using Sequential API to learn from our dataset. before training the model, we first have to compile the model. Compiling the model can be seen as <em>“getting your team ready for a big race by setting up the game plan, rules, and gear to ensure they perform their best.” </em>in our case here, we compile our models with optimizers, loss functions, metrics.</p><pre>model.compile(optimizer=Adam(learning_rate=0.1), loss=MeanAbsoluteError(), metrics=[RootMeanSquaredError()])</pre><p>then we proceed to fit the model.</p><pre>history = model.fit(train_dataset, validation_data=validation_dataset, epochs=100, verbose=1)</pre><p>In the <em>model.fit(), </em>we pass in our train_dataset, validation_dataset, epochs. The epochs can be seen as the number of times the model would train so as to adjust the weights and biases of the model.</p><p><strong>Generate performance metrics:</strong> After training the model, we would want to generate some metrics which speak to the performance of the model to data it has never seen. Here we can use metrics such as accuracy, precision, recall, F1_Score. In this post we would just be plotting the prediction of the model on the test_dataset and the actual_price to visualise the performance.</p><pre>y_true = list(y_test[:,0].numpy())<br>y_pred = list(model.predict(x_test)[:, 0])<br><br>ind = np.arange(100)<br>plt.figure(figsize=(40, 20))<br>width = 0.2<br>plt.bar(ind, y_pred, width, label=&#39;Predicted car prices&#39;)<br>plt.bar(ind + width, y_true, width, label=&#39;Actual price predicted&#39;)<br><br>plt.xlabel(&#39;Actual vs Predicted Prices&#39;)<br>plt.ylabel(&#39;Car Prices&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvGL5mqeXuYESJQQ65FF2g.png" /><figcaption>Predicted prices and Actual prices.</figcaption></figure><p>From the graph above, we can see that the model is able to make predictions close to the actual prices.</p><p><strong>Model optimisation: </strong>In model optimisation it just means fine-tunning parameters in the model to make the model perform better. In the car price prediction, we can change the learning rate, add more layers to the model to increase its complexity and re-train the model.</p><p>To summarise this post, we looked at what machine learning is, the basic workflow in machine learning, we trained a machine learning model to predict price of a car and plotted its performance.</p><p>I hope you really enjoyed this 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62b443ebb525" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connection Error from timbu.com]]></title>
            <link>https://medium.com/@sbolamatanmi/connection-error-from-timbu-com-63bec8c95d57?source=rss-edc69d7e8511------2</link>
            <guid isPermaLink="false">https://medium.com/p/63bec8c95d57</guid>
            <dc:creator><![CDATA[Samiat Bola-matanmi]]></dc:creator>
            <pubDate>Mon, 01 Apr 2019 18:50:02 GMT</pubDate>
            <atom:updated>2019-04-02T07:18:08.264Z</atom:updated>
            <content:encoded><![CDATA[<p>Connection Error from timbu.com</p><p>Hi, i have spent my IT days training in software development and one thing i was properly thought was how to identify bugs. Going through the site https://<a href="https://timbu.com/">timbu.</a>com/. I can guess you are thinking what is timbu.com well timbu.com is an app that helps with travelling around. The error which i noticed was located at the (index):1 page and it stated “ could not estalish connection end does not exist”.</p><p>Connection could not be established as receiver end does not exist.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63bec8c95d57" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>