<?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 Muhammed Ali Şahin on Medium]]></title>
        <description><![CDATA[Stories by Muhammed Ali Şahin on Medium]]></description>
        <link>https://medium.com/@sahinn.muhammed.alii?source=rss-483023e275d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Muhammed Ali Şahin on Medium</title>
            <link>https://medium.com/@sahinn.muhammed.alii?source=rss-483023e275d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:40:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sahinn.muhammed.alii/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[Understanding LoRA: Parameter-Efficient Fine-Tuning Explained with CNNs and ResNet18]]></title>
            <link>https://medium.com/@sahinn.muhammed.alii/understanding-lora-parameter-efficient-fine-tuning-explained-with-cnns-and-resnet18-bb219cb4712a?source=rss-483023e275d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb219cb4712a</guid>
            <dc:creator><![CDATA[Muhammed Ali Şahin]]></dc:creator>
            <pubDate>Sat, 09 May 2026 12:38:33 GMT</pubDate>
            <atom:updated>2026-05-09T12:38:33.611Z</atom:updated>
            <content:encoded><![CDATA[<p>Large deep learning models are powerful, but training or fine-tuning all parameters can be extremely expensive.</p><p>This is where <strong><em>LoRA (Low-Rank Adaptation)</em></strong> becomes important.</p><p>In this article, I explain:<br>- what LoRA actually is,<br>- why it works,<br>- how it reduces trainable parameters,<br>- and how I applied a Conv-LoRA approach on ResNet18 for CIFAR-10 image classification.</p><h3><strong>The Problem with Full Fine-Tuning</strong></h3><p>Modern deep learning models often contain millions or even billions of parameters.</p><p>For example:<br>- ResNet18 → ~11M parameters<br>- Large Vision Transformers → hundreds of millions<br>- LLMs → billions of parameters</p><p>Traditional fine-tuning updates <strong>all model weights</strong> during training.</p><p>While effective, this approach has major drawbacks:</p><p>- High GPU memory usage<br>- Large computational cost<br>- Slow training<br>- Difficult deployment for multiple tasks</p><p>This motivated researchers to develop <strong>parameter-efficient fine-tuning (PEFT)</strong> methods.</p><p>LoRA is one of the most popular approaches.</p><h3><strong>What is LoRA?</strong></h3><p>LoRA stands for: Low-Rank Adaptation</p><p>Instead of updating the original pretrained weights directly, LoRA freezes them and learns a small trainable update.</p><p>Normally, a neural network layer performs:<br>y = Wx</p><p>where:<br>- `W` is the pretrained weight matrix<br>- `x` is the input</p><p>LoRA modifies this as:<br>y = (W + ΔW)x</p><p>However, instead of learning the full `ΔW`, LoRA approximates it using two smaller matrices:<br>ΔW = BA</p><p>where:<br>- `A` is a low-rank matrix<br>- `B` is another low-rank matrix</p><p>This gives:<br>y = (W + BA)x</p><p>The key idea is that:<br>- `W` remains frozen<br>- only `A` and `B` are trained</p><p>This dramatically reduces the number of trainable parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3WQFqN-yJzA3c8CeMFhlw.png" /></figure><h3><strong>Why Does Low-Rank Adaptation Work?</strong></h3><p>A surprising observation in deep learning is that many task-specific updates do not require changing the entire weight space.</p><p>Instead, useful adaptations often lie in a much smaller subspace.</p><p>LoRA exploits this by restricting updates to a low-rank decomposition.</p><p>As a result:<br>- memory usage decreases<br>- training becomes faster<br>- pretrained knowledge is preserved<br>- adaptation becomes more efficient</p><h3><strong>LoRA in Vision Models</strong></h3><p>LoRA became extremely popular in:<br>- Large Language Models (LLMs)<br>- Vision Transformers (ViTs)<br>- Multimodal models</p><p>However, I wanted to experiment with LoRA in a CNN-based architecture.</p><p>So I implemented a Conv-LoRA approach on ResNet18 using the CIFAR-10 dataset.</p><h3>Experimental Setup</h3><p>Dataset:<br>- CIFAR-10</p><p>Models compared:<br>1. Simple CNN trained from scratch<br>2. Frozen ResNet18<br>3. Full fine-tuning ResNet18<br>4. ResNet18 with Conv-LoRA</p><p>For Conv-LoRA:<br>- most of the ResNet backbone was frozen<br>- LoRA adapters were applied to convolution layers in:<br> — layer2<br> — layer3<br> — layer4</p><p>Only a small fraction of the parameters were trainable.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*DjczWAewlELbfvC43DRGwA.png" /></figure><h3>Key Observation</h3><p>The most interesting result was:</p><p>Conv-LoRA achieved performance close to full fine-tuning while training only about 1% of the parameters.</p><p>This demonstrates the core advantage of parameter-efficient fine-tuning:<br>- fewer trainable weights<br>- lower computational cost<br>- competitive performance</p><h3>Why Frozen Models Perform Poorly</h3><p>One important observation was that simply freezing the pretrained backbone and training only the classifier head produced poor results.</p><p>Why?</p><p>Because:<br>- CIFAR-10 images are very small (32x32)<br>- ImageNet-pretrained features do not perfectly align with CIFAR-10<br>- the backbone needs some level of adaptation</p><p>LoRA provides this adaptation efficiently without full retraining.</p><h3>Final Thoughts</h3><p>LoRA is much more than a “memory optimization trick.”</p><p>It represents a fundamental idea: Large pretrained models often require only small task-specific adaptations.</p><p>This is why LoRA has become a core technique in:<br>- LLM fine-tuning<br>- multimodal systems<br>- efficient vision adaptation</p><h3>GitHub Repository</h3><p><a href="https://github.com/muhammedalisahinn/cnn-lora-image-classification">https://github.com/muhammedalisahinn/cnn-lora-image-classification</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb219cb4712a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Association Rule Learning with Apriori Algorithm]]></title>
            <link>https://medium.com/@sahinn.muhammed.alii/association-rule-learning-with-apriori-algorithm-649ba26b93b7?source=rss-483023e275d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/649ba26b93b7</guid>
            <dc:creator><![CDATA[Muhammed Ali Şahin]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 12:16:36 GMT</pubDate>
            <atom:updated>2023-03-28T09:35:41.478Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>1. Introduction</strong></blockquote><p>Data is an essential asset for individuals and organizations alike, and there is an abundance of data available worldwide. To store this vast amount of data, there are several repositories such as data warehouses, databases, and information repositories. However, to extract useful insights from this data, it needs to be processed. Data mining is a technique that involves processing, selecting, integrating, and retrieving valuable information from a large amount of data. It is an analytical tool that enables users to analyze, categorize, and summarize the relationships among the data. By using techniques such as clustering, classification, prediction, and association learning, data mining can discover valuable insights from large relational databases [1]. I will talk about the association rule in my article.</p><p>Association rule learning is a technique that aims to find connections between variables. For instance, a supermarket can collect data on how customers purchase different products. By applying association rule learning, the supermarket can identify which products are frequently bought together, which can be useful for marketing purposes. This is commonly referred to as market basket analysis [1].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*tR8buMXj-jxyjhEE" /><figcaption>Image 1: Association Rule Learning [2]</figcaption></figure><blockquote><strong>2. Association Rules:</strong></blockquote><p>Association rules are conditional statements that help to reveal connections between disparate data within a database, relational database, or other information repository. These rules are utilized to identify relationships between objects that are frequently used together. Association rules have a wide range of applications including basket data analysis, classification, cross-marketing, clustering, catalog design, and loss-leader analysis [1]. For example, if the customer buys sausage from the market, maybe he takes eggs with him. If the customer buys bread, maybe he can take butter with him and etc.</p><p>Association rules use three main criteria, support, confidence and lift value, to identify relationships and rules by analyzing data for frequently occurring if/then patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*JA06BnNYijhMmIxLSl3Xwg.png" /><figcaption>Image 2: Important concepts related to Associative Rule Learning [3]</figcaption></figure><ul><li>Support provides us with an estimation of how often the itemset appears in the dataset.</li><li>Confidence gives us an indication of how many times the rule analysed has been found to be accurate.</li><li>The lift of a rule represents the ratio of the discovered support to that expected if X and Y are independent.</li></ul><blockquote><strong>3. Apriori Algorithm:</strong></blockquote><p>There are many algorithms for Association Rule Learning, but since I use the apriori algorithm while writing my codes, I will talk about this algorithm here.</p><p>Apriori algorithm is used for frequent item set mining and association rule learning. In this algorithm, frequent subsets are extended one item at a time and this step is known as candidate generation process. Then groups of candidates are tested against the data. Apriori uses breadth-first search method and a hash tree structure.</p><p>The Apriori algorithm is used to identify frequent individual items in a database and extend them to larger item sets as long as they appear frequently enough in the database. By determining frequent item sets, the algorithm can identify association rules that highlight general trends within the database.</p><p>In the table below, I will try to explain the working logic of the apriori algorithm by examining 6 purchases made in a market. I will use Apriori to determine the frequent item sets of this database. To do this, we will say that an item set is frequent if it appears in at least 3 transactions of the database: the value 3 (%50 of Transaction) is the support threshold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*2_-3R9BoJQIA-kZo1iUvaA.png" /></figure><p>The first step of Apriori is to count up the number of occurrences, called the support, of each member item separately. By scanning the database for the first time, we obtain the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*VfZXofdBSCs4Qh89wtrPOg.png" /></figure><p>All the itemsets of size 1 have a support of at least 3, so they are all frequent. The next step is to generate a list of all pairs of the frequent items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*vctx_sFRKNutra4zP0Eclw.png" /></figure><p>We eliminate the painted lines because the support values ​​are below 3. Now we check the triple combinations with what we have left.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*7m2tvXwLzGWyRKWuRyyHBQ.png" /></figure><p>Only MEB (milk, egg, bread) reaches minimum support value.</p><p>Here are some of the inferences we can make:</p><p>Support= freq(X,Y) / N</p><ul><li>Someone who buys milk and eggs will buy bread with a 50% probability.</li><li>A person who buys milk has a 50% chance of getting an egg.</li></ul><p>The Apriori algorithm has two disadvantages. The first drawback is its complicated candidate generation process, which consumes significant time, space, and memory resources. The second drawback is that it necessitates multiple passes through the database.</p><blockquote><strong>4. Conclusion:</strong></blockquote><p>As a result, we aim to reveal product associations in shopping transactions with association rule learning, and after revealing these associations, we try to take action accordingly.</p><p><em>Thank you for your time.</em></p><blockquote><strong>5. Kaggle Notebooks:</strong></blockquote><p>My work on this topic: <a href="https://www.kaggle.com/code/muhammed47/online-retail-ii-arl">https://www.kaggle.com/code/muhammed47/online-retail-ii-arl</a></p><blockquote><strong>6. References:</strong></blockquote><p>[1] An Overview of Association Rule Mining Algorithms. (2014). <em>International Journal of Computer Science and Information Technologies</em>, <em>5</em>(1), 927–930. <a href="https://citeseerx.ist.psu.edu/document?repid=rep1&amp;type=pdf&amp;doi=d4058d9f3f66c53ddea776c974fbd740afd994b4">https://citeseerx.ist.psu.edu/document?repid=rep1&amp;type=pdf&amp;doi=d4058d9f3f66c53ddea776c974fbd740afd994b4</a></p><p>[2] <a href="https://analyticsarora.com/what-is-association-rule-learning-machine-learning-interview-questions/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=what-is-association-rule-learning-machine-learning-interview-questions">https://analyticsarora.com/what-is-association-rule-learning-machine-learning-interview-questions/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=what-is-association-rule-learning-machine-learning-interview-questions</a></p><p>[3] <a href="https://www.techleer.com/articles/238-concepts-behind-association-rule-mining/">https://www.techleer.com/articles/238-concepts-behind-association-rule-mining/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=649ba26b93b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Measurement Problems: Rating and Sorting]]></title>
            <link>https://medium.com/@sahinn.muhammed.alii/measurement-problems-rating-and-sorting-5e5b1233c4fe?source=rss-483023e275d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e5b1233c4fe</guid>
            <dc:creator><![CDATA[Muhammed Ali Şahin]]></dc:creator>
            <pubDate>Sun, 12 Mar 2023 18:36:23 GMT</pubDate>
            <atom:updated>2023-03-12T19:06:04.868Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>1. Introduction:</strong></blockquote><p>We all want to choose the right product when shopping, and the best movie when choosing a movie. So, which ways do manufacturers follow to bring us the right product? We can mention two problems here. The first is the rating and the second is the sorting problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*8dXj9MzA7f8HBBYi.jpg" /><figcaption>Image-1: Retrieved from <a href="https://baymard.com/blog/sort-by-customer-ratings">https://baymard.com/blog/sort-by-customer-ratings</a></figcaption></figure><blockquote>2. <strong>Rating:</strong></blockquote><p>First, let’s talk about the rating issue. Should everyone’ s vote be equally effective? Of course no. For example, let’s take two people on vacation in a hotel. The votes given by someone who makes use of all the facilities provided by the hotel and someone who does not intend to benefit from these facilities should not be equal. So we have to do user-based weighting. Likewise, the date of the vote is important. The votes that have been used recently should have a bigger impact. Maybe a few extra facilities may have been provided in the hotel I gave an example, and this will definitely affect the votes. We should also do time-based weighting. Finally, we have to make a rating by taking all these into account.</p><p>For example, considering the situation of people who bought a course, I found that it has a rating of 4.78 as a result of the functions below.</p><pre>def user_based_weighted_average(dataframe, w1=22, w2=24, w3=26, w4=28):<br>    return dataframe.loc[dataframe[&quot;Progress&quot;] &lt;= 10, &quot;Rating&quot;].mean() * w1 / 100 + \<br>        dataframe.loc[(dataframe[&quot;Progress&quot;] &gt; 10) &amp; (dataframe[&quot;Progress&quot;] &lt;= 45), &quot;Rating&quot;].mean() * w2 / 100 + \<br>        dataframe.loc[(dataframe[&quot;Progress&quot;] &gt; 45) &amp; (dataframe[&quot;Progress&quot;] &lt;= 75), &quot;Rating&quot;].mean() * w3 / 100 + \<br>        dataframe.loc[df[&quot;Progress&quot;] &gt; 75, &quot;Rating&quot;].mean() * w4 / 100</pre><pre>def time_based_weighted_average(dataframe, w1=28, w2=26, w3=24, w4=22):<br>    return dataframe.loc[dataframe[&quot;days&quot;] &lt;= 30, &quot;Rating&quot;].mean() * w1 / 100 + \<br>        dataframe.loc[(dataframe[&quot;days&quot;] &gt; 30) &amp; (dataframe[&quot;days&quot;] &lt;= 90), &quot;Rating&quot;].mean() * w2 / 100 + \<br>        dataframe.loc[(dataframe[&quot;days&quot;] &gt; 90) &amp; (dataframe[&quot;days&quot;] &lt;= 180), &quot;Rating&quot;].mean() * w3 / 100 + \<br>        dataframe.loc[df[&quot;days&quot;] &gt; 180, &quot;Rating&quot;].mean() * w4 / 100</pre><pre>def course_wieghted_rating(dataframe, time_w=50, user_w=50):<br>    return time_based_weighted_average(dataframe) * time_w/100 + user_based_weighted_average(dataframe) * user_w/100</pre><pre>course_wieghted_rating(df) # 4.782641693469868</pre><blockquote>3. <strong>Sorting:</strong></blockquote><p>Second part is the sorting. We have solved the rating problem, but is it correct to sort by rating only? This is where the number of purchases and similar things come into play. For example, it would not be correct for a product with an average of 5 but with 2 purchases to be higher than a product with an average of 4.7 but with 100 purchases. In this case, we should pay attention to the sorting process, taking into account factors such as this.</p><p>For example, we have a dataset with 32 courses sold on the online platform and it includes the number of purchases of these courses, the points given and the total number of comments made.</p><pre>df[[&quot;course_name&quot;, &quot;purchase_count&quot;, &quot;commment_count&quot;, &quot;rating&quot;]].head()<br>                                         course_name  purchase_count  commment_count  rating<br>0  (50+ Saat) Python A-Z™: Veri Bilimi ve Machine...           17380            4621 4.80000<br>1  Python: Yapay Zeka ve Veri Bilimi için Python ...           48291            4488 4.60000<br>2           5 Saatte Veri Bilimci Olun (Valla Billa)           18693            2362 4.40000<br>3    R ile Veri Bilimi ve Machine Learning (35 Saat)            6626            1027 4.60000<br>4  (2020) Python ile Makine Öğrenmesi (Machine Le...           11314             969 4.60000</pre><p>Here, we bring all the variables on the same scale, that is, between 0 and 5, so that one variable does not dominate the other.</p><pre>df[&quot;purchase_count_scaled&quot;] = MinMaxScaler(feature_range=(1, 5)). \<br>    fit(df[[&quot;purchase_count&quot;]]). \<br>    transform(df[[&quot;purchase_count&quot;]])</pre><pre>df[&quot;commment_count_scaled&quot;] = MinMaxScaler(feature_range=(1, 5)). \<br>    fit(df[[&quot;commment_count&quot;]]). \<br>    transform(df[[&quot;commment_count&quot;]])</pre><p>To see the difference better, let’s first look at the top 5 courses by rating, purchace_count_scaled and comment_count_scaled.</p><pre>df[[&quot;course_name&quot;, &quot;purchase_count_scaled&quot;, &quot;commment_count_scaled&quot;, &quot;rating&quot;]].sort_values(&quot;rating&quot;, ascending=False).head()<br>                                          course_name  purchase_count_scaled  commment_count_scaled  rating<br>0   (50+ Saat) Python A-Z™: Veri Bilimi ve Machine...                2.43801                5.00000 4.80000<br>10        İleri Düzey Excel|Dashboard|Excel İp Uçları                1.78937                2.95839 4.80000<br>19                     Alıştırmalarla SQL Öğreniyorum                1.25901                1.19766 4.80000<br>5                                            Course_1                1.37886                1.17859 4.80000<br>6                                            Course_2                1.26033                1.73602 4.70000</pre><pre>df[[&quot;course_name&quot;, &quot;purchase_count_scaled&quot;, &quot;commment_count_scaled&quot;, &quot;rating&quot;]].sort_values(&quot;purchase_count_scaled&quot;, ascending=False).head()<br>                                          course_name  purchase_count_scaled  commment_count_scaled  rating<br>1   Python: Yapay Zeka ve Veri Bilimi için Python ...                5.00000                4.88470 4.60000<br>11                                           Course_3                3.05375                1.21066 4.30000<br>2            5 Saatte Veri Bilimci Olun (Valla Billa)                2.54684                3.04161 4.40000<br>0   (50+ Saat) Python A-Z™: Veri Bilimi ve Machine...                2.43801                5.00000 4.80000<br>20                                           Course_9                2.07051                3.91634 4.50000</pre><pre>df[[&quot;course_name&quot;, &quot;purchase_count_scaled&quot;, &quot;commment_count_scaled&quot;, &quot;rating&quot;]].sort_values(&quot;commment_count_scaled&quot;, ascending=False).head()<br>                                          course_name  purchase_count_scaled  commment_count_scaled  rating<br>0   (50+ Saat) Python A-Z™: Veri Bilimi ve Machine...                2.43801                5.00000 4.80000<br>1   Python: Yapay Zeka ve Veri Bilimi için Python ...                5.00000                4.88470 4.60000<br>20                                           Course_9                2.07051                3.91634 4.50000<br>14                       Uçtan Uca SQL Server Eğitimi                2.06612                3.09623 4.70000<br>2            5 Saatte Veri Bilimci Olun (Valla Billa)                2.54684                3.04161 4.40000</pre><p>With the function we wrote last, we give a weight to all the variables and get a general score and we make the order accordingly.</p><pre>def weighted_sorting_score(dataframe, w1=36, w2=26, w3=42):<br>    return (df[&quot;commment_count_scaled&quot;] * w1 / 100 +<br>            df[&quot;purchase_count_scaled&quot;] * w2 / 100 +<br>            df[&quot;rating&quot;] * w3 / 100)</pre><pre>df[[&quot;course_name&quot;, &quot;purchase_count_scaled&quot;, &quot;commment_count_scaled&quot;, &quot;rating&quot;, &quot;weighted_sorting_score&quot;]].sort_values(&quot;weighted_sorting_score&quot;, ascending=False).head()<br>                                          course_name  purchase_count_scaled  commment_count_scaled  rating  weighted_sorting_score<br>1   Python: Yapay Zeka ve Veri Bilimi için Python ...                5.00000                4.88470 4.60000                 4.99049<br>0   (50+ Saat) Python A-Z™: Veri Bilimi ve Machine...                2.43801                5.00000 4.80000                 4.44988<br>20                                           Course_9                2.07051                3.91634 4.50000                 3.83822<br>14                       Uçtan Uca SQL Server Eğitimi                2.06612                3.09623 4.70000                 3.62583<br>2            5 Saatte Veri Bilimci Olun (Valla Billa)                2.54684                3.04161 4.40000                 3.60516</pre><p>As a result, the table we created by distributing the weights is different from other tables, and the result we want to see is the last table we got.</p><blockquote>4. <strong>Conclusion:</strong></blockquote><p>As a result, while scoring, attention should be paid to who gave the rating and when it was given. We have seen with the example that it can be a mistake to only look at the rating while ranking.</p><p><em>Thank you for your time.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e5b1233c4fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>