<?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 doedotdev on Medium]]></title>
        <description><![CDATA[Stories by doedotdev on Medium]]></description>
        <link>https://medium.com/@doedotdev?source=rss-3198a7ad7ea0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mUZMRX12pp0zkex2fFphSA.jpeg</url>
            <title>Stories by doedotdev on Medium</title>
            <link>https://medium.com/@doedotdev?source=rss-3198a7ad7ea0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:59:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@doedotdev/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[Gutting the Van | Ford Transit Van Conversion | Van 01 Log 07]]></title>
            <link>https://doedotdev.medium.com/gutting-the-van-ford-transit-van-conversion-van-01-log-07-bb92091c04fd?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb92091c04fd</guid>
            <category><![CDATA[build]]></category>
            <category><![CDATA[conversion]]></category>
            <category><![CDATA[ford]]></category>
            <category><![CDATA[vanlife]]></category>
            <category><![CDATA[vans]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Sun, 29 Nov 2020 18:57:25 GMT</pubDate>
            <atom:updated>2020-11-29T18:57:25.963Z</atom:updated>
            <content:encoded><![CDATA[<p>So you decided to buy a passenger van instead of a cargo van like me? Great! Before you can start the painful process of building, you have to tear out the ford build. Here are the steps I took and some things to consider before starting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-b3kZ0cuMp6OswnK3ne2g.jpeg" /><figcaption>This panoramic shot actually turned out okay, and that is pretty neat.</figcaption></figure><h4>Considerations</h4><ul><li>Taking it out means you will have a bear metal van left and will need to cover it with something. In some tight turns and corners, this is frustrating. So consider keeping some panels if you like them.</li><li>If you are buying a used van, there will be dirt under all the panels and floor. Taking it apart will require some cleaning before you can start building.</li><li>Panels, seats, rails, and parts can be sold to people who had some brake or were involved in an accident. Keeping them in good shape when removing them could get you some cash back!</li><li>Service. If you remove light or panel and cover it with something else, remember Ford might need to get in here and do some service at some point.</li></ul><h4>Floor</h4><p>I am a taller human, so removing the floor to insulate and lower it was a necessity. Where the stock floor is about 1.5 inches tall, I ended up finishing my floor with:</p><ul><li>.25 inches of minicell on top of corrugations</li><li>.5 inches of birch plywood on top of that</li><li>.1 inches of vinyl fake-wood on top of that</li></ul><p>That gives me a good amount of room back, about .75 inches!</p><p>The floor can be cut down the middle and taken out in halves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ObAzA7WWNsrfg5g0Ro0Shg.jpeg" /><figcaption>This is a dull pocket knife. I recommend not losing your razor blade.</figcaption></figure><p>Save the 2 halves for templating purposes for your next floor! Very useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YVg_l5pJ2dMBlCKMs1seg.jpeg" /><figcaption>Here it is sliced down the middle.</figcaption></figure><p>Here is what the underside of the 2 halves looks like when you fold them up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZbgkEt_VPaScsu9myrwaw.jpeg" /><figcaption>It was dusty and dirty under my floor.</figcaption></figure><p>That&#39;s it! Just a bit of gravity holding the floor down.</p><p>Note: A lot of builds I have seen just tear the carpet off the floor and put vinyl or wood flooring on top of it. This is probably a huge time saver. But if you want your floor insulated or you want it lowered, it&#39;s not an option!</p><h4>Ceiling</h4><p>This is the easiest part of the whole removal. Just be careful of the wires and lights. Also, be careful not to yank on any airbag cables or airbags. You will know if you yanked on an airbag because you will be in the hospital with a broken arm.</p><p>The ceiling comes out easy. I started with my rearmost panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czhtv_UsIdBZYW7eyAXOFg.jpeg" /><figcaption>The ceiling panels feel so much bigger when they are down.</figcaption></figure><p>Consider keeping the venting and air conditioning pieces out of the panels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNREHJoy3OVbVphGGFpI8w.jpeg" /></figure><p>Then tie the lights back up to deal with them later in the build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CR-aZQ-f2qXjcAIgQalYfA.jpeg" /><figcaption>I am writing a whole other log on how I dealt with these lights.</figcaption></figure><p>Super easy! Enjoy this. Not many parts of the build or tear down are this easy.</p><h4>Wall Panels</h4><p>This part is just tedious. Just pull hard. I recommend getting a small set of auto trim removal tools.</p><p><a href="https://www.amazon.com/MICTUNING-Removal-Molding-Fastener-Remover/dp/B07917TDL6/ref=sr_1_7?crid=2EIIDS0TRDKGZ&amp;dchild=1&amp;keywords=auto+trim+removal+tool+set&amp;qid=1606674873&amp;sprefix=auto+trim+remo%2Caps%2C232&amp;sr=8-7">Here is the link to the set I used.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*19PEADsvIJAopaTTz41Wdg.jpeg" /><figcaption><a href="https://www.amazon.com/MICTUNING-Removal-Molding-Fastener-Remover/dp/B07917TDL6/ref=sr_1_7?crid=2EIIDS0TRDKGZ&amp;dchild=1&amp;keywords=auto+trim+removal+tool+set&amp;qid=1606674873&amp;sprefix=auto+trim+remo%2Caps%2C232&amp;sr=8-7">https://www.amazon.com/MICTUNING-Removal-Molding-Fastener-Remover/dp/B07917TDL6/ref=sr_1_7?crid=2EIIDS0TRDKGZ&amp;dchild=1&amp;keywords=auto+trim+removal+tool+set&amp;qid=1606674873&amp;sprefix=auto+trim+remo%2Caps%2C232&amp;sr=8-7</a></figcaption></figure><p>Now just pick a panel and pull. You will notice some panels have a dependency on others to be removed. So as you go, you will see a pattern.</p><p>Pick a panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-HBe30MxyYpIXpi1pkoMw.jpeg" /><figcaption>This image might be hard to look at because my seat is lying flat on the ground.</figcaption></figure><p>Pull it off:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0ooDFcwg0YASFCjEXq-zw.jpeg" /><figcaption>This image might be hard to look at because my seat is lying flat on the ground.</figcaption></figure><p>Remove any plugs or fasteners that did not come along with it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3f05sUHHmminNkBe-3ce1A.jpeg" /><figcaption>This image might be hard to look at because my seat is lying flat on the ground.</figcaption></figure><p>Be ready for your hands to be sore for a day or two if you remove all these panels at once—lots of prying and pulling.</p><p>Good luck!</p><h4>Rear Doors</h4><p>These were the easiest to tear out. So easy, I did not take photos. Just pull the panels off. Here is a photo of how I framed it after the fact!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gb9evKlv-bqT6fobm08kg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irsXz3SPX-BdzC94BNdZCQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WW9R_AMRIppHkq55Fpu8Rw.jpeg" /></figure><h4>Side Door</h4><p>I did not remove any side door paneling yet. This is because it gets incredibly close to the van when it opens and closes. It will take some more serious planning to frame and insulate and panel and still allow it to close. I recommend looking at the gap area while opening and closing it to plan yours. This article will be updated if I finish the door!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7OGxHVJrQYWKIYnnhyXrsw.jpeg" /></figure><p>Note: My door handle broke when I first got the van. This was an easy $40 fix to get the part from ford. If you want them to do the work and fix it, how you build around the handle probably matters. Consider this!</p><h4>Steps and Entry Ways</h4><p>Often people will keep their step and entryway finishes. These people are smart.</p><ul><li>These are complex shapes you have to make yourself.</li><li>It will save you a ton of time.</li></ul><p>I did not keep mine!</p><ul><li>I wanted to lower the floor because I am tall.</li><li>I wanted to extend the sliding doorstep to create more surface area.</li><li>I wanted to extend the rear floor usable area as well.</li></ul><p>I could not find any photos of the step itself. But just look at yours. Here is the removed step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSQN1XKJ1ScG8KP6_L9Blg.jpeg" /><figcaption>Here is the removed step</figcaption></figure><p>You can see below why I removed it and did my own. Much smaller step, but more floor surface area! The step is still 8 inches deep and 18n inches wide. Plenty to get in and out safely!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*584nciy31GX_1VHVknUn8w.jpeg" /><figcaption>Here is my extended floor area with my custom step.</figcaption></figure><p>For the rear, you can see how much the step trim took up. About 8–12 inches or so!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YVg_l5pJ2dMBlCKMs1seg.jpeg" /><figcaption>the white area in the back was all covered by the rear step trim</figcaption></figure><p>I removed it and extended the floor as far as the back doors would allow!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDRxgShbIe4m37q5VM2Q2w.jpeg" /><figcaption>I was able to go almost an inch from the rear doors, and they still close fine!</figcaption></figure><p>And I later finished it with some metal stair trim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*llbu2toqmw33LEM2QCmwNw.jpeg" /><figcaption>The metal stair trim really helps with the durability of the vinyl on the entryways.</figcaption></figure><p>Warning: depending on how you do the rear trim and floor, you can cover up the spare tire release spot.</p><p>Bottom Line: I am happy I removed the step trims in the sliding door entryway and the rear door entryway. But it took a good amount of time to measure and plan and build. Keeping them is always easier.</p><h4>AC and Heat Ducting</h4><p>The rear heat comes out from under the passenger seat and circulates through the floor vents. Rear AC comes out from the back AC unit and circulates through the ceiling vents.</p><p>Here are the upper AC ducting and vents on the passenger side of the vehicle. It is the black ducting, not the green airbags and silver airbag charges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5eg0tmLhu_6yUwLZwE5Avg.jpeg" /></figure><p>Here is the ducting on the driver&#39;s side of the vehicle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6WhnNmj2XvLwZhfvB8x4pg.jpeg" /></figure><p>The ducting bridges on the back of the vehicle above the rear door opening.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNREHJoy3OVbVphGGFpI8w.jpeg" /><figcaption>See the black ducting bridge in the back ceiling of the van.</figcaption></figure><p>And here is all the ducting removed except for the main black “chimney” where it starts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wylR7wdVSQMNCaDdb6yR-Q.jpeg" /><figcaption>See the black chimney in the back right of the van.</figcaption></figure><p>Below you can see the rear ac in the bottom left with no ducting or main chimney attached. This is how I have been running it with no issues!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q0p4GkWLw6YRpLVO-Ov6-g.jpeg" /><figcaption>You can also see the load of shit I have pulled out of this van.</figcaption></figure><p>Here is a photo that is not mine from a van that is not mine of how the rear AC can be finished. It is super well done. I cannot find where this image is from! I will give credit when I find it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvW4pEegKGeYsyAAEGR7QA.jpeg" /><figcaption>Not my image. Not my van. Just some ideas on how to make the rear AC finished.</figcaption></figure><p>I kept the rear AC and rear heat but removed all ducting. It will still come out of those places and fill up the van just fine.</p><p>When removing the floor, you will notice the heat ducting will come up. I pretty much did the same as I did for the AC. Just removed all the ducting and let it come out from the source. You can see the large black strip of ducting on the floor that routes it to the floor vents.</p><p>Note: The floor vents are rectangular cut-outs. The plus-cross-like cutouts are for the seat rails attachments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*etO4tLIIRTDZz3ggiQUvuA.jpeg" /><figcaption>this as a template saved me hours on my custom floor install</figcaption></figure><p>Bottom Line: The van is small, 200 cubic feet give-or-take a depending on your model. When you fill this up with cabinets, beds, bikes, and clothes, there is not a whole lot of volume to cool or heat. Removing the ducting has really not made any difference in how the van heats/cools.</p><p>Note: My upper ducting was disconnected at 2 spots when I removed the ceiling. So it was already NOT doing its job. I would have never known unless I removed the ceiling.</p><h4>Seats and Seat Rails</h4><p>Keeping all 12 seats would not work for my build (and I can’t imagine a build it would work in). However, having a safe and seat belt outfitted seat can help take more than just the driver and passenger. Consider keeping the jump seat (the 1 seater by the door), or more. I kept the entire back row, which is 4 rails and 4 seats split into two 2-seaters.</p><p>Removing the seat rails takes some torque! It is a T35 or T30 star bit. I also purchased an extendable breaker bar to get them out. Very helpful!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A03iII1bnCDA_ZVPTdnk0w.jpeg" /><figcaption>Here is the jump seat by the door. Let’s remove it!</figcaption></figure><p>The bolts holding the seat rails go into nuts that ARE fixed to the van. This is great news. You don&#39;t have to worry about getting under the van to catch the nut or getting a friend to hold the nut under the van. Very happy when I learned this!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J7vlbSKc7JE7tODTaZY2Gg.jpeg" /></figure><p>You will notice the bolts are very rusty. They protrude from the bottom of the van and live outside.</p><p>Likewise, the hole they came from can be a bit rusty and dirty as well. It&#39;s not the van or the van frame, though, just the nut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ba330XFVZK0fMYYVyVmCtg.jpeg" /></figure><p>In my case, I wanted to keep a few rails that were extensions of others. To remove them, I unbolted the one I wanted to remove and kicked it with a hammer to dislodge it from the other one. It will come free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOwlkQMn0E2Y5K11DchC4g.jpeg" /><figcaption>You can see how they are layered together.</figcaption></figure><p>Now that the layered space is free, I filled this gap with a washer and bolted the one I kept back in! A little trial and error in the home depot washers section will find you the perfect diameter and thickness for this gap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8X97cg6QR3Cb8sii1hFKQ.jpeg" /></figure><p>Then snug it up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CHgb0opUgLtKVi576cx4Dw.jpeg" /></figure><p>You will notice you see through your van where all the holes are revealed. Make sure to cover these up. The original bolts easily cover the bolt holes. I also added some anti-rust compound and paint to keep them safer in the future. There are some “thumb” holes along the rails as well. Cover these up with rubber, flex seal tape, or something because water will find its way into the van.</p><p>Below you can see the bolt put back in with a super slim washer that is stainless steel. Again, this is some little trial and error in the home depot washer section. This will keep out any dirt and grime that was getting in before. I also added some Rustoleum to the bolt and hole to keep it rust-free for the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMphzPMyC48YPrZMRORqvg.jpeg" /></figure><p>Above, you can see the small thumb hole that is revealed by the seat rail being removed. Below you can see the waterproof seal tape I used to cover it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrR7OFwyXWokZxlk8jLfZg.jpeg" /></figure><p>Here is a preview of me finishing the floor around the seat rails that I kept! Read my article on the floor and floor insulation if you want to see how that went!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_6u-_HdxuyJpXpj_qQpVw.jpeg" /></figure><h4>Enjoy</h4><p>Enjoy your pile of plastic garbage. You did it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EtB8LdU1mzhZ3X4LZH6w3g.jpeg" /><figcaption>Yes, this teardown will make you feel wasteful.</figcaption></figure><h4>What I Would Do Different</h4><p>This might be the only log I have no considerations or regrets. I am awesome at breaking things. So this was easy.</p><p>Maybe I will say buying a newer or cleaner van. This thing was dirty under these panels!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb92091c04fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Table of Contents | Ford Transit Van Conversion | Van 01 Log 01]]></title>
            <link>https://doedotdev.medium.com/table-of-contents-ford-transit-van-conversion-van-01-log-01-12197e0e1a65?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/12197e0e1a65</guid>
            <category><![CDATA[vans]]></category>
            <category><![CDATA[vanlife]]></category>
            <category><![CDATA[ford]]></category>
            <category><![CDATA[build]]></category>
            <category><![CDATA[diy]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Fri, 27 Nov 2020 21:54:28 GMT</pubDate>
            <atom:updated>2020-11-29T18:59:45.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USAinrxNCX7xVxqZUCvc5A.jpeg" /></figure><p>In 2020 I decided to build a van. Here are the steps to research, purchase, and build a conversion van.</p><h3>Disclaimers</h3><ul><li>I wrote these in a way that would explain how I would do it if I had to do it again. That could be doing it better, doing it right, doing it cheaper, or doing it more quickly and making trade-offs.</li><li>I plan to do this again, so I prefixed the logs with Van 01 because Van 02 will come someday.</li><li>I am far from an expert; please use caution and do things at your own risk.</li><li>The prices reflect the MSRP of material and parts. Often you can find most items at a discount, you have most tools laying around or can borrow them, or you only use a portion of some materials. (example: 3M window weld, you need about 3–4 ounces of it and it comes in 16 ounces. So you pay $30 for it but use 1/4 of it. Moral of the story: You will have a lot of excess materials and parts, so build 4 vans at the same time to be more efficient, lol)</li><li>There is always a way to cut corners and do something faster and cheaper. If you want to do that, just put a cot in the back of your minivan.</li><li>If there is no link, then the log is not published or finished yet. But it is coming! Articles and photos may be updated or changed at any time.</li></ul><h3>Table of Contents</h3><p>V01 L01: <a href="https://doedotdev.medium.com/table-of-contents-ford-transit-van-conversion-van-01-log-01-12197e0e1a65">Table of Contents</a></p><p>V01 L02: Jumping In</p><p>V01 L03: Sprinter vs Promaster vs NV vs Transit</p><p>V01 L04: 2016 Ford Transit XLT Passenger High Roof</p><p>V01 L05: Cargo vs Passenger vs Crew Van</p><p>V01 L06: Momentum and Ordering Ahead</p><p>V01 L07: <a href="https://doedotdev.medium.com/gutting-the-van-ford-transit-van-conversion-van-01-log-07-bb92091c04fd">Gutting the Van</a></p><p>V01 L08: Seat Rail Removal</p><p>V01 L09: Sound Dampening Nightmare</p><p>V01 L10: Working with Air Bags</p><p>V01 L11: Floor Insulation</p><p>V01 L12: Floor Installation</p><p>V01 L13: Roof Rack Research</p><p>V01 L14: Roof Rack Installation</p><p>V01 L15: Side Ladder Installation</p><p>V01 L16: Fiamma Awning Install</p><p>V01 L17: Flat Line Van Co Review</p><p>V01 L18: Max Air Fan Install</p><p>V01 L19: Quarter Twenty (1/4–20) Hardware</p><p>V01 L20: Plus Nuts / Cross Nuts / Expansion Nuts</p><p>V01 L21: Cedar Tongue and Groove</p><p>V01 L22: Hemp Oil Stain</p><p>V01 L23: Ceiling Insulation</p><p>V01 L24: Ceiling Installation</p><p>V01 L25: Electrical, Wiring, and Solar</p><p>V01 L26: Storage Bed</p><p>V01 L27: Upper Cabinets</p><p>V01 L28: Base Cabinets</p><p>V01 L29: Butcher Block Counters</p><p>V01 L30: Sink and Water</p><p>V01 L31: Framing the Headliner</p><p>V01 L32: Curtains and Window Covers</p><p>V01 L33: Electric Heater</p><p>V01 L34: Hitch Install</p><p>V01 L35: Cracking and Replacing Windshield</p><p>V01 L36: Lift Kit</p><p>V01 L337: Purple Seat Cover</p><p>V01 L38: Tire and Wheel Upgrade</p><p>V01 L39: Dream Build</p><p>V01 L40: Van Do It Thoughts</p><p>V01 L41: Van Life Insurance</p><h3>Resources</h3><p>The internet was super useful in building this van. In no particular order, here are some resources to check out.</p><p>Far Out Ride: <a href="https://faroutride.com/">https://faroutride.com/</a></p><p>Ford Transit Forum: <a href="https://www.fordtransitusaforum.com/">https://www.fordtransitusaforum.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12197e0e1a65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mypy for | Github Action]]></title>
            <link>https://doedotdev.medium.com/mypy-for-github-action-7da1ebee99e7?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7da1ebee99e7</guid>
            <category><![CDATA[python-coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[mypy]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[code-quality-tools]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 01:22:52 GMT</pubDate>
            <atom:updated>2019-12-26T03:19:06.921Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mypy for Python | Github Action</h3><p>Mypy is an incredibly useful tool for checking python code quality. It is more specifically a static type checker.</p><p><a href="http://mypy-lang.org/">mypy</a></p><p>If you have not checked it out, I definitely recommend!</p><p>There are also many articles on why you SHOULD be type checking your python code. This is something I have begun doing consistently on anything outside of a jupyter notebook script. There are a few benefits to this.</p><ul><li>Code is more self documenting</li><li>They are optional, use when appropriate</li><li>Allows better code completion for most IDEs</li><li>Easier to find and fix errors (mypy)</li></ul><p>That being said, if you do use it, I recommend an automated Github Action to run it!</p><h4>Mypy Github Action</h4><p>Here is the action I use in my projects.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de1b3fb499efb6ba720884ac5d570d31/href">https://medium.com/media/de1b3fb499efb6ba720884ac5d570d31/href</a></iframe><p>Once you add this to your project, the next time you commit you will see the new action run!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*zNyJFJMyB32ZAXS7URMvtg.png" /><figcaption>Result Github Action Output for mypy.yml</figcaption></figure><p>That is it! Only thing to note is that my workflow runs against my src/ folder. If your code is in another directory, or you want to run on root, make sure to change that path appropriately.</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7da1ebee99e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pylint Static Code Analysis | Github Action to fail below a score threshold]]></title>
            <link>https://medium.com/analytics-vidhya/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/58a124aafaa0</guid>
            <category><![CDATA[pylint]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 01:53:05 GMT</pubDate>
            <atom:updated>2019-12-16T08:52:01.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdONJcyUQSEbtjm40vCIvw.jpeg" /><figcaption>Sheep make wool which makes lint and thats about as creative I can get for this article on code lint.</figcaption></figure><p>Pylint is an incredibly useful tool for static code analysis. It provides a simple score out of 10, a detailed output on what to fix, and the ability to ignore things you do not believe in.</p><p><a href="https://www.pylint.org/">Pylint - code analysis for Python | www.pylint.org</a></p><p>This is part three of three of a series I am doing on how I use Pylint in my projects.</p><ul><li>Part 1: Executing with Command Line vs Programmatically</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-executing-with-command-line-vs-programmatically-63797fb2ac22">Pylint Static Code Analysis | Executing with Command Line vs Programmatically</a></p><ul><li>Part 2: Pylint Runner Script with Changeable Threshold</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-python-script-with-adjustable-threshold-b0d6d2c8647b">Pylint Static Code Analysis | Python Script with Adjustable Threshold</a></p><ul><li><strong>Part 3: A Github Action for Failing Builds under a Pylint Threshold</strong></li></ul><h4>Pylint Github Action</h4><p>Github actions are incredibly useful for automatically doing things when you check in code. Build, Deploy, Test, and in this case, analyze code.</p><p><a href="https://github.com/features/actions">GitHub Actions · CI/CD and automations · Agentic Workflows · Workflows</a></p><p>In the last article, part 2 of the series, I went more in depth on how to create a Pylint runner that fails or passes dependent on if Pylint reaches the given threshold. You able to call the lint.py file with a specified path to code and a score threshold to pass or fail a build! Here is a copy of the script gist.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1f8eb331094f22e044ad29b0532f907/href">https://medium.com/media/e1f8eb331094f22e044ad29b0532f907/href</a></iframe><p>Now we can utilize that script to create a Github Action that passes or fails a build dependent on that score.</p><p>Here is the lint.yml code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15a84abd9cf30ab38b50f9a919578303/href">https://medium.com/media/15a84abd9cf30ab38b50f9a919578303/href</a></iframe><p>The build has 3 main steps:</p><ul><li>Setup Python environment, in this case 3.7</li><li>Install requirements, which is just Pylint in this case</li><li>Runs lint.py with a minimum threshold set</li></ul><p>This will produce a failed build if your code does not meet that threshold, which in the above case is 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-bS6S2MlZT_omoa9yVVDQ.png" /><figcaption>Notice the score 1.875 does not meet the threshold of 2.0</figcaption></figure><p>Here in a passed case (where I just lower the threshold to 1.5 in my workflow because this test code), your build will pass! It will still show potential opportunities to fix your code, as well as your input threshold and final score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3B_iWknk5o6gBcBzcIDbbQ.png" /></figure><p>Now your workflows history will show that your code has improved! (Or maybe you just changed your threshold…)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mH9DjWJZG4NlEL0lgCBEkQ.png" /></figure><p>I encourage you to look more into Github Actions where you can block merging on failed actions, deploy to pypi stratigh from actions, verify you tests work with every version of python you wany, and much more!</p><h4>Personal Note</h4><p>Real projects should expect much higher scores. My production projects usually are set to have <strong>9 or 9.5</strong> as the score threshold limit. However, I do use additional exclusions that differ from the base Pylint setup.</p><pre>C0114, # missing-module-docstring<br>C0115, # missing-class-docstring<br>C0116, # missing-function-docstring<br>R0903  # too-few-public-methods</pre><p>This snippet can be copy and pasted into the disable section of a .pylintrc file and it will ignore those errors and they will not lower your score.</p><h4>The End</h4><p>All the code for this three part series is on Github. It even uses its own code to run a Github Action against itself.</p><p><a href="https://github.com/doedotdev/wool">doedotdev/wool</a></p><p>If you got lost make sure to go back and touch up on part 2 of the series where I talk about usage of the lint.py file we ran in the Github Action.</p><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-python-script-with-adjustable-threshold-b0d6d2c8647b">Pylint Static Code Analysis | Python Script with Adjustable Threshold</a></p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58a124aafaa0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0">Pylint Static Code Analysis | Github Action to fail below a score threshold</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pylint Static Code Analysis | Python Script with Adjustable Threshold]]></title>
            <link>https://doedotdev.medium.com/pylint-static-code-analysis-python-script-with-adjustable-threshold-b0d6d2c8647b?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0d6d2c8647b</guid>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[code-analysis]]></category>
            <category><![CDATA[pylint]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 01:22:39 GMT</pubDate>
            <atom:updated>2019-12-12T02:53:20.830Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pylint Static Code Analysis | Python Script with Adjustable Score Threshold</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fQXPIEg7TN-QoTHv31g5Q.jpeg" /><figcaption>Sheep make wool which makes lint and thats about as creative I can get for this article on code lint.</figcaption></figure><p>Pylint is an incredibly useful tool for static code analysis. It provides a simple score out of 10, a detailed output on what to fix, and the ability to ignore things you do not believe in.</p><p><a href="https://www.pylint.org/">Pylint - code analysis for Python | www.pylint.org</a></p><p>This is part two of three of a series I am doing on how I use Pylint in my projects.</p><ul><li>Part 1: Executing with Command Line vs Programmatically</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-executing-with-command-line-vs-programmatically-63797fb2ac22">Pylint Static Code Analysis | Executing with Command Line vs Programmatically</a></p><ul><li><strong>Part 2: Pylint Runner Script with Changeable Threshold</strong></li><li>Part 3: A Github Action for Failing Builds under a Pylint Threshold</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0">Pylint Static Code Analysis | Github Action to fail below a score threshold</a></p><h4>Python Script with Adjustable Threshold</h4><p>In the previous article from part 1 above I did a very basic introduction to how to run Pylint programmatically with python. Here I use that same code and more to do the following.</p><ul><li>Parametrize code path input</li><li>Parametrize pylint score threshold</li><li>Run pylint on that input directory</li><li>Fail and exit 1 if the code fails to meet the threshold</li><li>Pass and exit 0 if the code meets the given threshold</li></ul><p>I have created this file in my project root as lint.py.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1f8eb331094f22e044ad29b0532f907/href">https://medium.com/media/e1f8eb331094f22e044ad29b0532f907/href</a></iframe><p>First, we read in our two arguements with argarse…</p><pre>import argparse<br><br>parser = argparse.ArgumentParser(prog=&quot;LINT&quot;)<br><br>parser.add_argument(&#39;-p&#39;,<br>                    &#39;--path&#39;,<br>                    help=&#39;path to directory you want to run pylint | &#39;<br>                         &#39;Default: %(default)s | &#39;<br>                         &#39;Type: %(type)s &#39;,<br>                    default=&#39;./src&#39;,<br>                    type=str)<br><br>parser.add_argument(&#39;-t&#39;,<br>                    &#39;--threshold&#39;,<br>                    help=&#39;score threshold to fail pylint runner | &#39;<br>                         &#39;Default: %(default)s | &#39;<br>                         &#39;Type: %(type)s &#39;,<br>                    default=7,<br>                    type=float)<br><br>args = parser.parse_args()<br>path = str(args.path)<br>threshold = float(args.threshold)</pre><p>Next, we run Pylint…</p><pre>from pylint.lint import Run<br><br>results = Run([path], do_exit=False)</pre><pre>final_score = results.linter.stats[&#39;global_note&#39;]</pre><p>Finally, we evaluate the score…</p><pre>if final_score &lt; threshold:</pre><pre>    raise Exception()</pre><pre>else:</pre><pre>    exit(0)</pre><p>In the full Gist code snippet above I use proper logging, outputs, and exception messages to make sure the runner is clear in what it is doing and in the final output!</p><h4>Here are a few sample runs.</h4><p>First we run the lint.py and it uses the default values and assume the source path as ./src and the score threshold as 7.</p><pre>$ <strong>python lint.py</strong><br></pre><pre>************* Module src.two<br>src/two.py:12:0: C0304: Final newline missing</pre><pre>------------------------------------------------------------------<br>Your code has been rated at 1.88/10 (previous run: 1.88/10, +0.00)</pre><pre>Exception: PyLint Failed | Score: 1.875 | Threshold: 7.0</pre><p>You can also specify your threshold by using the parametrized arguments! In this example the code fails again and exits(1) because the code did not meet the threshold of 5.</p><pre>$<strong> python lint.py --path ./src --threshold 5</strong><br></pre><pre>************* Module src.two<br>src/two.py:12:0: C0304: Final newline missing</pre><pre>------------------------------------------------------------------<br>Your code has been rated at 1.88/10 (previous run: 1.88/10, +0.00)</pre><pre>Exception: PyLint Failed | Score: 1.875 | Threshold: 5.0</pre><p>If the code were to pass, like in the next example, it will exit(0) and all is well! Notice how the threshold argument can take a float like 1.5 in this case.</p><pre>$<strong> python lint.py --path ./src --threshold 1.5</strong><br></pre><pre>************* Module src.two<br>src/two.py:12:0: C0304: Final newline missing</pre><pre>------------------------------------------------------------------<br>Your code has been rated at 1.88/10 (previous run: 1.88/10, +0.00)</pre><pre>PyLint Passed | Score: 1.875 | Threshold: 1.5</pre><h4>Bonus</h4><p>Run with less verbose args.</p><pre>$ <strong>python lint.py -p ./src -t 1.5</strong></pre><p>Get help if you forget how to run it!</p><pre>$ <strong>python lint.py -h</strong></pre><pre>optional arguments:<br>  -h, --help            show this help message and exit</pre><pre>  -p PATH, --path PATH  path to directory you want to run pylint | Default: ./src | Type: str</pre><pre>  -t THRESHOLD, --threshold THRESHOLD<br>                        score threshold to fail pylint runner | Default: 7 | Type: float<br></pre><h4>Personal Note</h4><p>Real projects should expect much higher scores. My production projects usually are set to have <strong>9 or 9.5</strong> as the score threshold limit. However, I do use additional exclusions that differ from the base Pylint setup.</p><pre>C0114, # missing-module-docstring<br>C0115, # missing-class-docstring<br>C0116, # missing-function-docstring<br>R0903  # too-few-public-methods</pre><p>This snippet can be copy and pasted into the disable section of a .pylintrc file and it will ignore those errors and they will not lower your score.</p><h4>The End</h4><p>The code above and from this series can be found on Github!</p><p><a href="https://github.com/doedotdev/wool">doedotdev/wool</a></p><p>The next article talks about utilizing the python lint.py script and using it as a Github Action to automatically pass/fail builds based on code quality.</p><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0">Pylint Static Code Analysis | Github Action to fail below a score threshold</a></p><p>The previous article in the series talks about running Pylint on the command line vs programatically.</p><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-executing-with-command-line-vs-programmatically-63797fb2ac22">Pylint Static Code Analysis | Executing with Command Line vs Programmatically</a></p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0d6d2c8647b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pylint Static Code Analysis | Executing with Command Line vs Programmatically]]></title>
            <link>https://doedotdev.medium.com/pylint-static-code-analysis-executing-with-command-line-vs-programmatically-63797fb2ac22?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/63797fb2ac22</guid>
            <category><![CDATA[pylint]]></category>
            <category><![CDATA[code-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[code-quality-tools]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 00:08:46 GMT</pubDate>
            <atom:updated>2019-12-12T02:55:05.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-thJFNyIp4mRq7j_f5P4dw.jpeg" /><figcaption>Sheep make wool which makes lint and thats about as creative I can get for this article on code lint.</figcaption></figure><p>Pylint is an incredibly useful tool for static code analysis. It provides a simple score out of 10, a detailed output on what to fix, and the ability to ignore things you do not believe in.</p><p><a href="https://www.pylint.org/">Pylint - code analysis for Python | www.pylint.org</a></p><p>This is part one of three of a series I am doing on how I use pylint in my projects.</p><ul><li><strong>Part 1: Executing with Command Line vs Programmatically</strong></li><li>Part 2: Pylint Runner Script with Changeable Threshold</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-python-script-with-adjustable-threshold-b0d6d2c8647b">Pylint Static Code Analysis | Python Script with Adjustable Threshold</a></p><ul><li>Part 3: A Github Action for Failing Builds under a Pylint Threshold</li></ul><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0">Pylint Static Code Analysis | Github Action to fail below a score threshold</a></p><h4>Command Line vs Programmatically</h4><p>In both of these instances, you will have to install Pylint.</p><pre>$ pip install pylint</pre><p>This should give you confirmation it is installed.</p><pre>.<br>.<br>.<br>Installing collected packages: pylint<br>Successfully installed pylint-2.4.4</pre><p>I will assume your code is in a folder called src/. Now to run on your project with the command line you can run the following.</p><pre>$ pylint src/</pre><p>Which should give you some output from the static code analysis followed by a score!</p><pre>************* Module src.src_hi<br>src/src_hi.py:6:0: C0103: Constant name &quot;logger&quot; doesn&#39;t conform to UPPER_CASE naming style (invalid-name)<br>************* Module src.src_try<br>src/src_src.py:11:2: W0511: TODO: test (fixme)</pre><pre>------------------------------------------------------------------<br>Your code has been rated at 9.55/10 (previous run: 9.55/10, +0.00)</pre><p>But what if you want to do the same with python code? First make a python file in your project directory at the same level you ran the above script, I will call it simple.py.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c65cdcabd98fea6a5a32fbc3ffc82e5a/href">https://medium.com/media/c65cdcabd98fea6a5a32fbc3ffc82e5a/href</a></iframe><p>Then run the python file and you should see the same output as you got before!</p><pre>$ <strong>python simple.py</strong></pre><pre>************* Module src.src_hi<br>src/src_hi.py:6:0: C0103: Constant name &quot;logger&quot; doesn&#39;t conform to UPPER_CASE naming style (invalid-name)<br>************* Module src.src_try<br>src/src_src.py:11:2: W0511: TODO: test (fixme)</pre><pre>------------------------------------------------------------------<br>Your code has been rated at 9.55/10 (previous run: 9.55/10, +0.00)</pre><p>Now that you know how to run with the command line and from a python script, we can go into a more in depth into utility.</p><p><a href="https://medium.com/@doedotdev/pylint-static-code-analysis-python-script-with-adjustable-threshold-b0d6d2c8647b">Pylint Static Code Analysis | Python Script with Adjustable Threshold</a></p><p>This code above and from the next to parts of the series can be found on Github!</p><p><a href="https://github.com/doedotdev/wool">doedotdev/wool</a></p><p>Thanks!</p><h4>Personal Note</h4><p>Real projects should expect much higher scores. My production projects usually are set to have <strong>9 or 9.5</strong> as the score threshold limit. However, I do use additional exclusions that differ from the base Pylint setup.</p><pre>C0114, # missing-module-docstring<br>C0115, # missing-class-docstring<br>C0116, # missing-function-docstring<br>R0903  # too-few-public-methods</pre><p>This snippet can be copy and pasted into the disable section of a .pylintrc file and it will ignore those errors and they will not lower your score.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63797fb2ac22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2018 Gold Trek Crockett Disc | Single Speed Gravel Build]]></title>
            <link>https://doedotdev.medium.com/2018-gold-trek-crockett-disc-single-speed-gravel-build-53278b37bc94?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/53278b37bc94</guid>
            <category><![CDATA[trek]]></category>
            <category><![CDATA[cycling]]></category>
            <category><![CDATA[bikes]]></category>
            <category><![CDATA[singlespeed]]></category>
            <category><![CDATA[bicycles]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 00:31:40 GMT</pubDate>
            <atom:updated>2018-11-20T00:31:40.587Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jehRBBFIZal01FnWZMDjeg.jpeg" /></figure><p>I recently posted my Crockett road build. I only did this because I was tearing it down for an actual road bike and I will probably never see it again.</p><p><a href="https://medium.com/@mtngt/trek-crockett-disc-custom-1x-force-road-build-efeff76d2b62">2018 Gold Trek Crockett Disc | Custom Road Build</a></p><p>All cool bikes come to an end. To make cooler bikes.</p><h3>Photos</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHU5PyFjp02rgaSI8LkUMw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AiS5qrBYONcB5GtM5gyPNw.jpeg" /><figcaption>I run 2 cogs so I can flip between them. But mostly not lose them.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTHO8u-kUebHi6X3GS1jgw.jpeg" /><figcaption>Wolf tooth 40t dop-stop chain ring.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIDtQrVpDzjBBtmRmd9u0Q.jpeg" /><figcaption>Force 1x cranks.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuCXf74pBZBXQ6wkZzbmkQ.jpeg" /><figcaption>Sram XX1 Eagle Gold Chain</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IftoFJFOlaSEDKwBGXsAfQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGYB801RrDazQj_74l1Itw.jpeg" /><figcaption>Tukt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRWxCrQY5FB72Lx-J6QEmA.jpeg" /><figcaption>3–5mm all around for clearance.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDtox8hZzaaza4wkGotdkQ.jpeg" /><figcaption>And a little bit more clearance in the rear.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9bR4_9b4usRtoMnk1rAlWw.jpeg" /><figcaption>Bontrager GR2 700x40mm tires set up tubless</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r2zRedKhLN7EGpn02IzwjA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jehRBBFIZal01FnWZMDjeg.jpeg" /></figure><h4>Summary</h4><p>Weight: a little over 18lbs (the wheels and frame are pretty hefty, tbh)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53278b37bc94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local Outlier Factor | Simple Python Example]]></title>
            <link>https://doedotdev.medium.com/local-outlier-factor-simple-python-example-8925dad97fe6?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8925dad97fe6</guid>
            <category><![CDATA[science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[math]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 00:06:45 GMT</pubDate>
            <atom:updated>2018-11-20T00:12:34.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RAibC1ZdD5fsjUt5-CIlig.jpeg" /></figure><p>Most of you are here because you read my Local Outlier Factor | Example By Hand article. If you haven’t, go ahead and check it out here.</p><p><a href="https://medium.com/@mtngt/local-outlier-factor-example-by-hand-b57cedb10bd1">Local Outlier Factor | Example By Hand</a></p><p>The good news is, the implementation is easier than all that paper stuff. However I think it is good to know the basics before scaling it.</p><h4>The Code</h4><p>The code lives here.</p><p><a href="https://github.com/mtngt/local_outlier_factor">mtngt/local_outlier_factor</a></p><p>It is tested pretty well, and works well. However these things are still on the todo list.</p><ul><li>Support more distance functions</li><li>Test for decimal values (x = 2.5 and y = 3.53635423) as right now it only works for whole number points)</li><li>Stress tests for hundreds of thousands of points</li><li>Optimize for hundreds of thousands of points</li></ul><h4>The Problem</h4><p>In the following examples I will be using manhattan distance and a k value of 2 on the following coordinates.</p><pre>Point (X,Y)<br>a     (0,0)<br>b     (0,1)<br>c     (1,1)<br>d     (3,0)</pre><pre>(Working on a markdown generator for these basic charts.)</pre><pre>2-|<br>  |<br>1-|*b *c<br>  |<br>0-|*a_________*d<br>  |   |   |   |<br>  0   1   2   3</pre><h4>Sample Runs</h4><p>This is implemented as an ordered dict. However, I googled around for the most common forms I saw X,Y coordinates in and accept four different ways to input coordinates.</p><p><strong>Input as OrderedDict: </strong>Note, this is the only method to name your coordinates. Every other input method will name the coordinates for you.</p><pre>coords_as_ordered_dict = OrderedDict([<br>    (&#39;a&#39;, OrderedDict([<br>        (&#39;x&#39;, 0),<br>        (&#39;y&#39;, 0)<br>    ])),<br>    (&#39;b&#39;, OrderedDict([<br>        (&#39;x&#39;, 0),<br>        (&#39;y&#39;, 1)<br>    ])),<br>    (&#39;c&#39;, OrderedDict([<br>        (&#39;x&#39;, 1),<br>        (&#39;y&#39;, 1)<br>    ])),<br>    (&#39;d&#39;, OrderedDict([<br>        (&#39;x&#39;, 3),<br>        (&#39;y&#39;, 0)<br>    ]))<br>])<br><br>test_lof = lof.LOF(coords_as_ordered_dict, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.print_all_lof()</pre><p><strong>Output:</strong></p><pre>a: 0.8749999999999999<br>b: 1.3333333333333333<br>c: 0.8749999999999999<br>d: 2.0</pre><p><strong>Input as Array of Tuples: </strong>Notice we aren’t giving the points names anymore. They will name themselves.</p><pre>coords_as_array_of_tuples = [(0, 0), (0, 1), (1, 1), (3, 0)]<br><br>test_lof = lof.LOF(coords_as_array_of_tuples, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.print_all_lof()</pre><p><strong>Output:</strong></p><pre>coord_0_x_0_y_0: 0.8749999999999999<br>coord_1_x_0_y_1: 1.3333333333333333<br>coord_2_x_1_y_1: 0.8749999999999999<br>coord_3_x_3_y_0: 2.0</pre><p><strong>Input as CSV File of one X,Y pair per line: </strong>Notice we aren’t giving the points names anymore. They will name themselves.</p><p><strong>csv file:</strong><em> test.csv</em></p><pre>0,0<br>0,1<br>1,1<br>3,0</pre><p><strong>Code with input as csv file name: </strong>Notice we aren’t giving the points names anymore. They will name themselves.</p><pre>test_lof = lof.LOF(&#39;test.csv&#39;, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.print_all_lof()</pre><p><strong>Output:</strong></p><pre>coord_0_x_0_y_0: 0.8749999999999999<br>coord_1_x_0_y_1: 1.3333333333333333<br>coord_2_x_1_y_1: 0.8749999999999999<br>coord_3_x_3_y_0: 2.0</pre><p><strong>Input as X and Y Array: </strong>Notice we aren’t giving the points names anymore. They will name themselves.</p><pre>x = [0, 0, 1, 3]<br>y = [0, 1, 1, 0]<br>coords_as_x_y_array = [x, y]<br><br>test_lof = lof.LOF(coords_as_x_y_array, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.print_all_lof()</pre><p><strong>Output:</strong></p><pre>coord_0_x_0_y_0: 0.8749999999999999<br>coord_1_x_0_y_1: 1.3333333333333333<br>coord_2_x_1_y_1: 0.8749999999999999<br>coord_3_x_3_y_0: 2.0</pre><h4><strong>Other Methods</strong></h4><p>But wait, there is more.</p><p><strong>Sorting LOFs Ascending:</strong></p><pre>test_lof = lof.LOF(self.coords, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.get_lof_sorted_filtered(False)</pre><p><strong>Output:</strong> Sorted Ascending</p><pre>(&#39;a&#39;, 0.8749999999999999)<br>(&#39;c&#39;, 0.8749999999999999)<br>(&#39;b&#39;, 1.3333333333333333)<br>(&#39;d&#39;, 2.0)</pre><p><strong>Sorting LOFs Descending:</strong></p><pre>test_lof = lof.LOF(self.coords, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.get_lof_sorted_filtered(True)</pre><p><strong>Output:</strong> Sorted Descending</p><pre>(&#39;d&#39;, 2.0)<br>(&#39;b&#39;, 1.3333333333333333)<br>(&#39;a&#39;, 0.8749999999999999)<br>(&#39;c&#39;, 0.8749999999999999)</pre><p><strong>Filtering LOFs in Range:</strong> Values greater than 1 and less than 2</p><pre>test_lof = lof.LOF(self.coords, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.get_lof_sorted_filtered(False, 1, 2)</pre><p><strong>Output: </strong>The only value greater than 1 and less than 2</p><pre>(&#39;b&#39;, 1.3333333333333333)</pre><p><strong>Filtering LOFs in Range Descending:</strong> Values greater than 0 and less than 2</p><pre>test_lof = lof.LOF(self.coords, lof.LOF.CONST_MANHATTAN, 2)<br>lofs = test_lof.get_lof_sorted_filtered(True, 0, 2)</pre><p><strong>Output:</strong></p><pre>(&#39;b&#39;, 1.3333333333333333)<br>(&#39;a&#39;, 0.8749999999999999)<br>(&#39;c&#39;, 0.8749999999999999)</pre><h4>Get All Data About a Coordinate</h4><p><strong>Code:</strong></p><pre>test_lof = lof.LOF(self.coords, lof.LOF.CONST_MANHATTAN, 2)<br>test_lof.print_all_data()</pre><p><strong>Output:</strong></p><p>This will show you the following info</p><ul><li>X coordinate</li><li>Y coordinate</li><li>K nearest nodes</li><li>Distance to its K nearest nodes</li><li>local outlier factor</li><li>local reachability distance * (ONLY IF IT WAS NEEDED TO BE CALCULATED TO SOLVE THE FINAL LOF PROBLEM. YOU RARELY HAVE TO SOLVE THIS FOR EVERY POINT)</li></ul><pre>{<br>    &quot;a&quot;: {<br>        &quot;x&quot;: 0,<br>        &quot;y&quot;: 0,<br>        &quot;k_nearest_nodes_distances&quot;: {<br>            &quot;b&quot;: 1,<br>            &quot;c&quot;: 2<br>        },<br>        &quot;local_outlier_factor&quot;: 0.8749999999999999,<br>        &quot;local_reachability_distance&quot;: 0.6666666666666666<br>    },<br>    &quot;b&quot;: {<br>        &quot;x&quot;: 0,<br>        &quot;y&quot;: 1,<br>        &quot;k_nearest_nodes_distances&quot;: {<br>            &quot;a&quot;: 1,<br>            &quot;c&quot;: 1<br>        },<br>        &quot;local_reachability_distance&quot;: 0.5,<br>        &quot;local_outlier_factor&quot;: 1.3333333333333333<br>    },<br>    &quot;c&quot;: {<br>        &quot;x&quot;: 1,<br>        &quot;y&quot;: 1,<br>        &quot;k_nearest_nodes_distances&quot;: {<br>            &quot;b&quot;: 1,<br>            &quot;a&quot;: 2<br>        },<br>        &quot;local_reachability_distance&quot;: 0.6666666666666666,<br>        &quot;local_outlier_factor&quot;: 0.8749999999999999<br>    },<br>    &quot;d&quot;: {<br>        &quot;x&quot;: 3,<br>        &quot;y&quot;: 0,<br>        &quot;k_nearest_nodes_distances&quot;: {<br>            &quot;a&quot;: 3,<br>            &quot;c&quot;: 3<br>        },<br>        &quot;local_outlier_factor&quot;: 2.0<br>    }<br>}</pre><h3>Wrap Up</h3><p>I got a lot of views and requests on my implementation by hand article so I felt this was worth it.</p><p><a href="https://medium.com/@mtngt/local-outlier-factor-example-by-hand-b57cedb10bd1">Local Outlier Factor | Example By Hand</a></p><p>I hope you enjoyed. If this performs well I will look into improving, optimizing, and packaging this up.</p><p>If you find any issues just tell me or open a pull request!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8925dad97fe6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2018 Gold Trek Crockett Disc | Custom Road Build]]></title>
            <link>https://doedotdev.medium.com/trek-crockett-disc-custom-1x-force-road-build-efeff76d2b62?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/efeff76d2b62</guid>
            <category><![CDATA[trek]]></category>
            <category><![CDATA[road-cycling]]></category>
            <category><![CDATA[bicycles]]></category>
            <category><![CDATA[bikes]]></category>
            <category><![CDATA[cycling]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Mon, 12 Nov 2018 01:28:58 GMT</pubDate>
            <atom:updated>2019-12-07T20:14:46.569Z</atom:updated>
            <content:encoded><![CDATA[<h3>2018 Trek Crockett Disc | Custom 1X Road Build</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtzUGPnnuXjb_OiKCzt-Pg.jpeg" /><figcaption>I ❤ GOLD</figcaption></figure><p>After purchasing the 2017 Trek Crockett complete build, I really enjoyed it for an entire cross season. I liked it so much, I decided to buy a second to replace my recently broken (car accident) road bike.</p><h4>Frame</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wqdi0LfVOlBsDBOorxZ0g.jpeg" /><figcaption>AMS Frame Guard</figcaption></figure><ul><li><a href="https://www.trekbikes.com/us/en_US/bikes/road-bikes/cyclocross-bikes/crockett/crockett-disc-frameset/p/17467/">Crockett Disc Frameset | Trek Bikes</a></li><li><a href="https://www.allmountainstyle.com/products/ams-honeycomb-frame-guard-wolf">AMS Honeycomb Frame Guard. WOLF</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8W8HvAD27tKYFu-d3AEbw.jpeg" /></figure><p><a href="https://www.cotopaxi.com/pages/pro-sticker-please">Sticker Please!</a></p><p><strong>Wheels</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aL0dvIphz2jLpWFSGPtaaA.jpeg" /></figure><p><a href="https://bikerumor.com/2016/07/14/review-bontrager-aeolus-5-aero-tubeless-ready-carbon-clinchers-r3-tires/">Review: Bontrager Aeolus 5 aero, tubeless disc brake carbon clinchers &amp; R3 tires - Bikerumor</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51hs0yvdNyaMh54Rqk7uoQ.jpeg" /><figcaption>Look back at it</figcaption></figure><h4>Group-set</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfQJk_skAwMPrVKQwHxPKw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwY1V6qu7zrS4Gt0onSelQ.jpeg" /><figcaption>Sram Force 1x long cage with 10–42 cassette</figcaption></figure><ul><li><a href="https://www.sram.com/sram/road/family/sram-force-1">SRAM Force 1 | SRAM Road | SRAM</a></li><li><a href="https://www.sram.com/sram/mountain/products/xx1-eagle-chain">XX1 Eagle™ Chain</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2iEXT1IZHkqGEumEsVnpw.jpeg" /><figcaption>Chain ring still looks good after 2500 miles.</figcaption></figure><p><a href="https://absoluteblack.cc/cx-oval-sram-direct-mount-chainring-cx1/">absoluteBLACK | Cyclocross OVAL Sram DM CX 1X chainring</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*So1t5x13110TlL8fCMS-ww.jpeg" /><figcaption>Cassette and chain have about 2500 miles and still no stretch, but a little worn.</figcaption></figure><h4><strong>Finishing Kit</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hba5C4RvZXzxhG7jJbdCnw.jpeg" /><figcaption>46cm Bontrager XXX Bars</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZpM_D2eT1Vi1f-hwFFlKpg.jpeg" /><figcaption>The rubber on force hoods get super stretched out after good use</figcaption></figure><ul><li><a href="https://www.trekbikes.com/us/en_US/equipment/cycling-components/bike-handlebars-accessories/bike-handlebars/road-bike-handlebars/bontrager-xxx-vr-c-road-handlebar/p/09833/">Bontrager XXX VR-C Road Handlebar | Trek Bikes</a></li><li><a href="https://www.trekbikes.com/us/en_US/equipment/cycling-components/bike-handlebar-grips-tape/handlebar-tape/bontrager-grippytack-handlebar-tape/p/14245/">Bontrager Grippytack Handlebar Tape | Trek Bikes</a></li></ul><h4><strong>More Photos</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lgMoV2t9eJFrvTK6eJGRxQ.jpeg" /><figcaption>Non-drive side</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXDrr9NURynNRUoDs119vQ.jpeg" /><figcaption>Didn’t line up the down-tube frame guard quite right…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUf8DhSrui4J8CshUYohQg.jpeg" /><figcaption>Trek Art</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtzUGPnnuXjb_OiKCzt-Pg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtzUGPnnuXjb_OiKCzt-Pg.jpeg" /><figcaption>Thanks for Reading!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efeff76d2b62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local Outlier Factor | Simple Example By Hand]]></title>
            <link>https://doedotdev.medium.com/local-outlier-factor-example-by-hand-b57cedb10bd1?source=rss-3198a7ad7ea0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b57cedb10bd1</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[doedotdev]]></dc:creator>
            <pubDate>Wed, 25 Apr 2018 23:58:36 GMT</pubDate>
            <atom:updated>2019-12-10T02:12:37.891Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oIBy8uys2MEMZOR8OEN4GA.jpeg" /></figure><p>Local Outlier Factor value is a commonly used anomaly detection tool. It takes a local approach to better detect outliers about their neighbors, whereas a global strategy, might not be the best detection for datasets that fluctuate in density.</p><p>Before we get started, I am going to assume you know a bit about DBSCAN and K Nearest Neighbor algorithms. However, I am confident you can make it through without needing an incredibly deep understanding of the algorithms.</p><ul><li><a href="https://en.wikipedia.org/wiki/DBSCAN">DBSCAN - Wikipedia</a></li><li><a href="https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm">k-nearest neighbors algorithm - Wikipedia</a></li></ul><p>This is the implementation by hand, on a minimal and straightforward dataset. However, seeing it by hand I feel gives the best understanding initially.</p><p>Here is my implementation.</p><p><a href="https://medium.com/@mtngt/local-outlier-factor-simple-python-example-8925dad97fe6">Local Outlier Factor | Simple Python Example</a></p><h3>Local Outlier Factor Calculation in 6 Steps</h3><ul><li>Distance Calculation</li><li>Kth-Nearest Neighbor Distance Calculation</li><li>K-Nearest Neighbor Calculation</li><li>Local Reachability Density (LRD) Calculation</li><li>Local Outlier Factor Calculation</li><li>Analysis</li></ul><h3>The Problem</h3><p>Calculate the Local Outlier Factor (LOF) for each point and find the top 2 outliers. Use a “K” value of 2 and Manhattan Distance as the distance function.</p><pre>Point (X,Y)<br>a     (0,0)<br>b     (0,1)<br>c     (1,1)<br>d     (3,0)</pre><pre>(Working on a markdown generator for these basic charts.)</pre><pre>2-|<br>  |<br>1-|*b *c<br>  |<br>0-|*a_________*d<br>  |   |   |   |<br>  0   1   2   3</pre><h3>Distance Calculation</h3><p>Multiple distance functions out there, but as I specified in the problem above, we are going to be using Manhattan to allow easy calculations by hand.</p><p><a href="https://math.stackexchange.com/questions/139600/how-to-calculate-the-euclidean-and-manhattan-distance">How to calculate the Euclidean and Manhattan distance?</a></p><pre>manhattanDistance(a,b) = 1<br>manhattanDistance(a,c) = 2<br>manhattanDistance(a,d) = 3<br>manhattanDistance(b,c) = 1<br>manhattanDistance(b,d) = 4<br>manhattanDistance(c,d) = 3</pre><h3>Kth-Nearest Neighbor Distance Calculation</h3><p>As prescribed in the problem, we are going to use a K value of 2. This means we need to find the Kth, 2nd, nearest neighbor of each point. That is the 2nd closest point to each.</p><pre>manhattanDistance(a,b) = 1<br><strong>manhattanDistance(a,c) = 2</strong><br>manhattanDistance(a,d) = 3</pre><pre>the second nearest neighbor of a is c.</pre><pre>Therefore,</pre><pre>kthNearestNeighbor(a) = c<br>kthNearestNeighbor(b) = c (a and c are same distance, choose either)<br>kthNearestNeighbor(c) = a<br>kthNearestNeighbor(d) = c (c and a are same distance, choose either)</pre><p>Now calculate the distance of each point to it’s kth, in our case 2nd, nearest neighbor.</p><pre>distanceToKthNearestNeighbor(a) = manhattanDistance(a,c)<strong> = 2<br></strong>distanceToKthNearestNeighbor(b) =<strong> </strong>manhattanDistance(b,c)<strong> = 1<br></strong>distanceToKthNearestNeighbor(c) = manhattanDistance(c,a)<strong> = 2<br></strong>distanceToKthNearestNeighbor(d) =<strong> </strong>manhattanDistance(d,c)<strong> = 3</strong></pre><h3>K-Nearest Neighbor Calculation</h3><p>Find the K, in our case 2, nearest neighbors of each value. You have already found the 2nd above, we just need the first in the set.</p><pre>kNearestSet(a) = { b, c }<br>kNearestSet(b) = { a, c }<br>kNearestSet(c) = { b, a }<br>kNearestSet(d) = { a, c }</pre><pre>How many items are in each set?</pre><pre>kNearestSetCount(a) = 2<br>kNearestSetCount(b) = 2<br>kNearestSetCount(c) = 2<br>kNearestSetCount(d) = 2</pre><p>You can do some of these steps in whatever order you like, however it will begin to make sense why I spell out the process.</p><h3>Local Reachability Density (LRD) Calculation</h3><p>LRD is the estimated distance at which a point can be found by its neighbors (NOT THE OPPOSITE, read that 2x). So if a neighbor were to reach out LRD value distance in any direction, it would be likely/ most optimal to find that individual point.<br>The LRD is the count of the items in the K nearest neighbor set which is calculated above as kNearestSetCount(point), over the reachDistance of the point to all the values in it’s set, which is kNearestSet above.</p><pre>                     kNearestSetCount(a)<br>LRD(a) = ---------------------------------------------<br>         reachDistance(b &lt;- a) + reachDistance(c &lt;- a)</pre><p>What is reachDistance? The max value of the Kth, 2nd in our case, nearest neighbor of the point and the Manhattan distance of between the point and it’s neighbor, two things we already calculated.</p><p>Here is an example of b &lt;- a.</p><pre>reachDistance(b &lt;- a) = <br>       max{distanceToKthNearestNeighbor(b), manhattanDistance(a,b)}</pre><pre>reachDistance(b &lt;- a) = max{1,1}</pre><pre>reachDistance(b &lt;- a) = 1</pre><p>Here is c &lt;- a.</p><pre>reachDistance(c &lt;- a) = <br>       max{distanceToKthNearestNeighbor(c), manhattanDistance(a,c)}</pre><pre>reachDistance(c &lt;- a) = max{2,2}</pre><pre>reachDistance(c &lt;- a) = 2</pre><p>We know reachDistance, we can complete the LRD calculation.</p><pre>                      kNearestSetCount(a)<br>LRD(a) = ---------------------------------------------<br>         reachDistance(b &lt;- a) + reachDistance(c &lt;- a)</pre><pre>LRD(a) =  2/(1 + 2) </pre><pre>LRD(a) = .667</pre><p>Calculate the LRD for the following points.</p><pre>                kNearestSetCount(b)<br>LRD(b) = ---------------------------------------------  = .5<br>         reachDistance(a &lt;- b) + reachDistance(c &lt;- b)<br></pre><pre>                kNearestSetCount(c)<br>LRD(c) = ---------------------------------------------  = .667<br>         reachDistance(a &lt;- c) + reachDistance(b &lt;- c)<br></pre><pre>                kNearestSetCount(d)<br>LRD(d) = ---------------------------------------------  = .33<br>         reachDistance(a &lt;- d) + reachDistance(c &lt;- d)</pre><p>Remember reachDistance is different from LRD, and you need one to calculate the other!</p><h3>Local Outlier Factor Calculation</h3><p>The final LOF value of each point can now be calculated. The LOF of a point p is the sum of the LRD of all the points in the set kNearestSet(p) * the sum of the reachDistance of all the points of the same set, to the point p, all divided by the number of items in the set, kNearestSetCount(p), squared.</p><pre>Reminder calculated above: <br>kNearestSet(a) = { b, c }<br>kNearestSetCount(a) = 2<br></pre><pre>         [LRD(b) + LRD(c)] * [reachDist(b &lt;- a) + reachDist(c &lt;- a)]<br>LOF(a) = ----------------------------------------------------------<br>               kNearestSetCount(a)*kNearestSetCount(a)</pre><pre>LOF(a) = [.5 + .667] * [1 + 2] / (2 * 2)</pre><pre>LOF(a) = 3.501 / 4</pre><pre>LOF(a) = .87</pre><p>Now that we see a full one worked out, I will quickly show the next 3 points LOF.</p><pre>         [LRD(a) + LRD(c)] * [reachDist(a &lt;- b) + reachDist(c &lt;- b)]<br>LOF(b) = ----------------------------------------------------------<br>               kNearestSetCount(b)*kNearestSetCount(b) </pre><pre><br>LOF(b) = 1.33<br></pre><pre>         [LRD(b) + LRD(a)] * [reachDist(a &lt;- c) + reachDist(b &lt;- c)]<br>LOF(c) = ----------------------------------------------------------<br>               kNearestSetCount(c)*kNearestSetCount(c)<br></pre><pre>LOF(c) = .87<br></pre><pre>         [LRD(a) + LRD(c)] * [reachDist(a &lt;- d) + reachDist(c &lt;- d)]<br>LOF(d) = ----------------------------------------------------------<br>               kNearestSetCount(d)*kNearestSetCount(d)<br></pre><pre>LOF(d) = 2</pre><h3>Analysis</h3><p>So what does this mean?</p><pre>LOF(a) = .87<br>LOF(b) = 1.33<br>LOF(c) = .87<br>LOF(d) = 2</pre><blockquote>Well, it depends on the data.</blockquote><p>While a LOF value of 1 or less is a good indicator of an inlier, we are here to calculate and <strong>probably</strong> remove outliers or anomalies.</p><p>Do you have a tight, clean, and uniform dataset? Then a LOF value of 1.05 could be an outlier.</p><p>Do you have a sparse dataset, varying in density, with many local fluctuations specific to that local cluster? Then a LOF value of 2 could still be an inlier.</p><p>So, it depends. There are many different variations/ additions to this base algorithm. However, we set out to find and prune the top 2 outliers from out set, which turned out to be b and d.</p><p>Any questions or mistakes, please comment.</p><p>More to come with anomaly detection with python and data science!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b57cedb10bd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>