teleren/devto huggingface dataset:
Random Forest (part 2)
Published: 2020-11-30 04:06:55

In the previous post, we outlined how Random Forest algorithm works. Here I would like to explore the concepts described in [part 1](https://dev.to/xsabzal/random-forest-algorithm-overview-2n42) on a dataset by using scikit-learn. Dataset details can be found [here](https://dev.to/xsabzal/gini-splitting-criterion-475f
).

**1) Bootstrap aggregating.**
When creating a data set from random samples for each tree, we can estimate that 63.2% (1 - 1/e, for large n) of the data points are unique and the remaining are duplicates. While the number of these sampled data sets is defined by the number of trees in Random Forest.

Tree #1 out of 100, with max_depth=2:
![Tree # 1](https://dev-to-uploads.s3.amazonaws.com/i/fhzhvssydfljz8s74paz.png)

Tree #71 out of 100, with max_depth=2:
![Tree # 71](https://dev-to-uploads.s3.amazonaws.com/i/70vhc5duaf203i28e50n.png)

Tree #100 out of 100, with max_depth=2:
![Tree # 100](https://dev-to-uploads.s3.amazonaws.com/i/teizvvry0jjtepwfwgrx.png)

As we can see the number of unique data points(rows) is close to the expected 63.2% for each sampled data set.

**2) Random selection of the features at each step.** 
Here we used 'auto', which is the same as max_features=sqrt(n_features) per scikit-learn random forest classifier documentation. In this example, the algorithm uses 2 random features (n_features=4) and then applies specified criteria (e.g. [Gini](https://dev.to/xsabzal/gini-splitting-criterion-475f
)) to select the best feature out of these two to split the tree. This randomization of the feature selection is applied at each node till the tree reaches some specified parameter, e.g. maximum depth.

**3) Making prediction.**
As we know Random Forest creates multiple trees and for the classification problem, each tree has an equal vote. So, the class with more votes will be selected and projected to the user as a predicted answer. 
In this case,  we have 100 trees, and each test data point (=row) X_test[i] will go through each tree. For example, if we get 60 trees with an answer = class 0 and 40 trees with an answer = class 1. As 60>40, class 0 will be selected as the final answer of Random Forest algorithm for a particular data point.
Mocking ง่ายๆใน VSCode
Published: 2020-11-30 04:06:07

เวลา dev ด้วย VSCode แล้วตอนจะลอง integrate test กับ service อื่นๆบนเครื่องตัวเอง วิธีที่ง่ายมากๆเลยคือใช้ extension ที่ชื่อ EasyMock

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5zifhkyoas3sul4wzgrn.png)

วิธีใช้ ให้ติดตั้ง extension ก่อน 
จากนั้นเปิด Command Palette ขึ้นมาแล้วพิมพ์หา EasyMock

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cxsepyntqztwegqcbte6.png)

เลือก Run EasyMock โดย Default มันจะเปิด Browser ขึ้นมาแบบนี้ให้เอง

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pgxr4kdjm4sz9xr4f057.png)

เท่านี้เราก็สามารถเริ่มใช้ EasyMock ได้แล้ว ซึ่งตัว Extension มันจะไปสร้าง example ให้ที่ ./mock/example.js ใน project ปัจจุบันนี้เลย โดยเราสามารถไปแก้ไขไฟล์ example.js โดยการกำหนดา path ที่จะให้เรียกเข้ามา แล้วก็ response ที่ต้องการ
โดยเบื้องต้นใน example.js ก็จะมีให้เรียกใช้เช่น

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yz48bl2yy5nso8tgbqbl.png)

แบบนี้เวลาทดสอบงานก็ง่ายขึ้นเยอะเลย
Por Que Black Fridays Dão Errado? - Hipsters.talks
Tags: video, hipsters, podcast, technology
Published: 2020-12-03 20:03:02

---
title: Por Que Black Fridays Dão Errado? - Hipsters.talks
published: true
date: 2020-11-30 03:21:41 UTC
tags: video,hipsters,podcasts,technology
canonical_url: https://blog.lsantos.dev/por-que-black-fridays-dao-errado/
cover_image: https://raw.githubusercontent.com/khaosdoctor/blog-assets/master/images/2020/11/EnrsXk0XcAIFaRK.jpg
---

Tive o enorme prazer de ser o convidado surpresa neste quadro do Hipsters que adoro! O [Gabs Ferreira](https://twitter.com/o_gabsferreira) me chamou para participar de um papo super descontraído para discutirmos junto com o [Mário](https://twitter.com/mario_fts)e a [Patrícia](https://twitter.com/Paty_Go) sobre histórias de Black Friday.

Foi um papo super bacana e ele está totalmente disponível de graça neste link! Assista e dê seus comentários!

E você? Tem alguma história de black friday para contar?

<iframe width="612" height="344" src="https://www.youtube.com/embed/CTPTdHbhyaU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Code Smell 38 - Abstract Names
Tags: oop, codenewbie, naming, webdev
Published: 2020-11-30 03:09:16

*Avoid too abstract names. Names should have real world meaning*

# Problems

- Implemental Naming

- Meaningless names

- Broken [MAPPER](https://maximilianocontieri.com/what-is-wrong-with-software) and [Bijection](https://maximilianocontieri.com/the-one-and-only-software-design-principle) to real world entities.

# Solutions

1. Choose meaningful names.

2. Find metaphors.

3. Avoid words like *abstract*, *base*, *generic*, *helper* etc.

4. Use [rules](https://maximilianocontieri.com/what-exactly-is-a-name-part-ii-rehab) for naming.

# Sample Code

## Wrong

{% gist https://gist.github.com/mcsee/568bc61348f648e3e0db8434b59b92a2 %}

## Right

{% gist https://gist.github.com/mcsee/106a64e384b1348dea8b1d486b4bacc5 %}

# Detection

We can set up policies and rules warning for certain words like *base, abstract, helper, manager, object etc*.

# Tags

- Naming

# Conclusion

Finding names is the last thing we should do on our designs. Unless we have a clear business understanding, good names emerge at the end after defined behavior and protocol boundaries.

# Relations

{% post https://dev.to/mcsee/code-smell-22-helpers-2j6j %}

{% post https://dev.to/mcsee/code-smell-25-pattern-abusers-2dgi %}

# More info

[what is in a name](https://maximilianocontieri.com/what-exactly-is-a-name-part-ii-rehab)

# Credits

Photo by <a href="https://unsplash.com/@frostroomhead">Rodion Kutsaev</a> on <a href="https://unsplash.com/s/photos/abstract">Unsplash</a>

* * *

> There are only two hard things in Computer Science: cache invalidation and naming things.

_Phil Karlton_
Flasker - Definitely Minimal Flask Boilerplate
Published: 2020-11-30 03:05:46

---
title: Flasker - Definitely Minimal Flask Boilerplate 
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I created a minimal Flask boilerplate for developers who want to create a Flask-based web apps from scratch, quickly.

The boilerplate repo: https://github.com/tyu1996/flasker

![Flasker GIF](https://dev-to-uploads.s3.amazonaws.com/i/xs4yg7hj14v01younh5g.gif)

It is minimal enough that devs are given flexibility and no need to spend too much time trying to understand the codebase. With some experience with Flask, you can start to develop right away.

This boilerplate has complete set of what minimal web app should have: webpages, routes, forms, and models. It comes with a sample template so you can check around the web app first by running the _run.sh_.
How to Print Calendar of Any Year in Python
Published: 2020-11-30 02:55:28

{% youtube nejvUeEPgZE %}

```Python

import calendar 
#This Will import the calendar module
year = int(input("Enter any year: ")) 
#Here we are asking user to input year and we are storing 
#it into year variable.
print(calendar.calendar(year))
#Here we are using calendar method of calendar module and passing 
#year as arguments and this will return us calendar of the year 
#and then with the help of print function we are printing the
#returned data."""

```
How to migrate Blazor Webassembly to .NET 5
Tags: blazor, dotnet, net5
Published: 2020-11-30 02:34:01

.NET 5 is out today! It's a big milestone and comes with [a huge list](https://devblogs.microsoft.com/dotnet/announcing-net-5-0/?WT.mc_id=DOP-MVP-5003878) of improvements. I've been working a bit with **Blazor **lately, trying to brush up [my gamedev skills](https://www.davideguida.com/blazor-and-2d-game-development-part-1-intro/?swcfpc=1) again. So I took the chance and decided to upgrade [my little pet project](https://github.com/mizrael/Blazeroids) to the latest version :)

The first thing to do is to [install or update](https://visualstudio.microsoft.com/downloads/?WT.mc_id=DOP-MVP-5003878) Visual Studio 2019 to version 16.8.0. For those interested, the release notes are [available here](https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.8.0). In case you're using a different IDE (or you're on Linux/Mac), you can directly download [the .NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0?WT.mc_id=DOP-MVP-5003878) instead.

Once you've done installing, fire up your **Blazor** project and open the .csproj file. We're going to change few little things:

1.  At the very top, update the SDK from *Microsoft.NET.Sdk.Web* to *Microsoft.NET.Sdk.BlazorWebAssembly*
```
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
```

2\. Set the *TargetFramework* to *net5.0*

3\. In case you have it, remove the package reference to *[Microsoft.AspNetCore.Components.WebAssembly.Build](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebAssembly.Build)*

4\. Update your Nuget dependencies

Now make sure you Clean your entire solution, otherwise, the build engine won't be able to re-generate all the required files with the updated framework.

Enjoy!
What Machine Learning can do?
Published: 2020-10-26 05:54:27

There are a lot of companies hiring machine learning engineers/specialists. Notable among them are the IT companies like IBM, Accenture, Apple, Walmart, Google, Ola, Flipkart, and a lot more. Learners’ who would finally be acquiring the skill set in this certification course in [Online Training in Machine Learning](https://www.igmguru.com/machine-learning-ai/machine-learning-certification-training/) would end up in the below-mentioned profiles

Machine learning engineer
Machine learning specialist
Machine learning research engineer
Data Scientist (at times)
Machine learning is a set of statistical techniques that could be built using any tool/platform or programing language targeting a specific business problem. The tool used is to express the techniques and statistical concepts of machine learning in a business area. The tool of our choice for this machine learning course is one of the most famous and easy to use a programming language which also finds a lot of preference in the industry owing to its ease of deployment and extensive community support. The tool is an open-source programming language, based on the concept of object-oriented programming language known as Python. Python is a programming language that could be used to do a lot of things, but learners will focus on the machine learning aspect of it in this best machine learning course.

Machine learning has been broadly classified into three categories – supervised, unsupervised, and reinforcement. Our focus of interest would be mostly into the Supervised and Unsupervised area.

Machine learning (ML) is the study of computer algorithms that improve automatically through experience. Machine learning is an application of artificial intelligence that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.
Hacer Running Viene Bien
Published: 2020-11-30 02:19:34

¡El <a href="https://corrercomodeporte.com/pod-de-dinamica-de-carrera-garmin-corrercomodeporte/">running</a> es un buen asesino de calorías! ¿No pudiste resistirte a la torta, las papas fritas y el chocolate hoy? Entonces ponte tus zapatillas y sal por la puerta, porque correr quema unas 250-300 kilocalorías por media hora. Así que si corres regularmente, tu cuerpo se pone en forma automáticamente. No sólo tus piernas se volverán más firmes, sino que también se entrenará tu estómago, tu espalda y tus nalgas, ya que al correr se mueve alrededor del 70 por ciento de tus músculos.

<b>Te recomiendo <b>

Si estás empezando a correr, es difícil correr durante 20 o 30 minutos sin un descanso. ¡Pero su rendimiento aumenta relativamente rápido! Ya después de las dos primeras semanas su resistencia mejora (si corre unas 3 veces por semana), tiene más energía e incluso las cosas cotidianas como subir escaleras o correr tras el bus no le quitan el aliento tan rápidamente.
First Time Working with Twitter API
Tags: twitter, javascript, opensource, github
Published: 2020-11-30 02:11:50

It's been a while for updating my blog. Last week, I was in the hospital waiting for a small surgery. With a smartphone and 250 MB of data, I can't really work on any project in the hospital room. However, I had an ongoing project and I really wanted to solve the issue that I faced. I stared at the ceiling in my small room and imagine that I have a screen on the ceiling to solve my code issue. Yes, just like Beth in the Queen's Gambit.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iyy12vuhwegwlvnq8hg3.jpg)

The project that kept occupying me is [Twitter-Block-With-Love](https://github.com/E011011101001/Twitter-Block-With-Love). It is a user script that helps Twitter users to block or mute likers or retweeters from a specific post. I've used it for a while and did enjoy using it to improve my Twitter experience. Although, I've always wanted to a feature that allow the user to also mute/block members from [Twitter list](https://help.twitter.com/en/using-twitter/twitter-lists). Therefore, I filed this issue and volunteered to work on this feature. The owner of the repo was very friendly and gave me this opportunity to work on it.

I have some basic knowledge of working with API. However, I've never worked on one before. In this project, it uses [Twitter API](https://developer.twitter.com/en/docs/twitter-api). There is a GET method to retrieve the members in a list which makes my job way easier. I use Postman to test the GET method.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ekykr7cnqjxea3mn6h1r.png)

The issue I had was, I can't get the data of the members such as id, name, location, etc. That was an issue that I couldn't solve before I went to the hospital. However, after a week away from the project, I just came up with a different way to get the data I need, and it worked! Just like usual, the best way to resolve a bug that you've been struggled for a long time is to leave it for a while, go work on other projects or leave the desk to do something else such as cleaning the toilet or walk the dog.

Although it is late, I'm still happy that I'm able to finish the Release 0.3 in my open-source course. Hopefully, I can finish other school works before the end of this term! 

Stay health and safe :)
X-ercise -  Fitness and health app built in REACT NATIVE
Published: 2020-11-30 01:55:22

Hi All,

After several months of work, our app is now published so you can start trying it and see if you like it.

The aim of the app is tracking your daily workouts the most easy way possible. We include complex and easiest workouts with single and supersets exercises, so the app can be used by novice and experienced exercisers as well.

Also, we work together with several personal trainers so we can offer pre-defined workouts.

I hope you enjoy it.

Download:

Google play store: https://play.google.com/store/apps/details?id=com.xercise

Instagram: https://www.instagram.com/xerciseapp/

Landing Page: https://www.x-erciseapp.com/

Product Hunt: https://www.producthunt.com/posts/x-ercise
Rock, Paper, Scissors on 1 Tweet
Tags: nim, python
Published: 2020-11-30 01:42:15

---
title: Rock, Paper, Scissors on 1 Tweet
published: true
description: Rock, Paper, Scissors Game on 1 Tweet
tags: nim, python
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/31tsiy6pw7a0uo5utmkp.jpg
---

This is my "Rock, Paper and Scissors" Game on 1 Tweet.

```nim
import random

randomize()
echo "Rock r\nPaper p\nScissor s"

let
  o = ["rock", "paper", "scissor"]
  pc = rand 0 .. 2
  us = case stdin.readLine[0]
    of 'r': 0
    of 'p': 1
    else:   2

echo "\nPC\tYou\tWinner\n", o[pc], '\t', o[us], '\t', case (3 + pc.ord - us.ord) mod 3
  of 1: "PC"
  of 2: "You"
  else: "No"

```

How to run the code:

```
$ nim r file.nim

Rock    r
Paper   p
Scissor s

p

PC      You     Winner
paper   paper   No

$
```

Keys:
- Rock = <kbd> r </kbd>
- Paper = <kbd> p </kbd> 
- Scissors = <kbd> s </kbd>

It is not even too code-golfed, because we can remove the line `import random` by compiling with ` --import:random `.

We can remove the `randomize()` but then we need to recompile to make the PC choose another option, so is not a good idea.

{% twitter 1333221690554396672 %}

It uses the `random` module from standard library:
https://nim-lang.github.io/Nim/random.html

`case` switch from from standard library:
https://nim-lang.github.io/Nim/manual.html#statements-and-expressions-case-statement

`readLine` to read a line from standard input:
https://nim-lang.github.io/Nim/io.html#readLine%2CFile

- **How your Rock, Paper and Scissors game looks like?**


# Thank you for reading

[![](https://thepracticaldev.s3.amazonaws.com/i/4huq62a5r8tck64apdtd.png)](https://nim-lang.org)

- [Telegram Nim English.](https://t.me/nim_lang)
- [Telegram Nim en Español.](https://t.me/NimArgentina)

Come learn programming with us...
👑
How to design google homepage in html.
Tags: html, css, webdev, tutorial
Published: 2020-11-30 01:37:36

So you have been wondering how Google was design with different colors it is very simple logic.
First, place a 'div' in your html with an `id` of `googleHome`.
```
<div id="googleHome"></div>
```
inside the `div` open a p tags and write the following code
 ```html
  <span style='color: blue'>G</span>
  <span style='color: red'>o</span>
  <span style='color: yellow'>o</span>
  <span style='color: blue'>g</span>
  <span style='color: green'>l</span>
  <span style='color: red'>e</span>
</p>
<input type="search" name="searchBox"><br>
<p>
<button>google search</button>
<button>I'm Feeling Lucky</button>
<br><br>
Google offered in: <a>Hausa</a> <a>Igbo</a> 
<a>Èdè Yorùbá</a> <a>Nigerian Pidgin</a>
</p> 
```
Now you have to hop into css and type the following code
```css
span{font-size:44px;}
body{text-align:center;}
input{width: 40vw;
height: 9vh;
border-radius: 45px 44px 44px 44px;
font-size:34px;}
button{margin: 11px;
height: 5vh;
background: #fff;
border: #eee 1px solid;
text-align:center;
border-radius:11px 0px 0px 0px }
a{color: blue;}
googleHome{
margin-top:15vh;}
}
```
Unbelievable! we just make the google home page . this is it below.
[link](https://jsfiddle.net/9mgfkpyd/21/).
Enjoy coding!!

if you have any question don't hesitate to ask. chat me up on [WhatsApp](https://wa.me/2349153036869?text=Hey!%%20Maxwizard%20l=I%20need%20your%20assistance%20from%20dev) or [Mail](mailto:aoladejo382@stu.ui.edu.ng?Subject=Hey!%%20Maxwizard%20l=I%20need%20your%20assistance%20from%20dev). Don't forget to follow me on [Twitter](https://twitter.com/oladejoabdulla7) so that you don't miss any of my articles.
Learn Blazor for WebDev and get to use C# in all the layers
Tags: blazor, dotnet, csharp, tutorial
Published: 2020-11-30 01:02:52

---
title: Learn Blazor for WebDev and get to use C# in all the layers
published: true
description: This is a collection of articles covering Blazor. There's also a 20 min intro video.
tags: blazor, dotnet, csharp, tutorial
---

## -1- Overview video

This 20 min video gives you a mile high view of Blazor covering component input and output, routing, HTTP and a little on Forms. It's a good place to start

{% youtube QmoJVew-9cU %}

## -2- First introduction to Blazor

This article goes through all you need to know to get started but also gives you enough knowledge to keep building out your skills.
{% link https://dev.to/dotnet/blazor-the-future-of-net-web-apps-a-first-look-m8 %}

## -3- JavaScript interop and Blazor

Sometimes you need to talk to JavaScript, even if you mostly will do C#. This shows how you can include an NPM package as part of your Blazor app.
{% link https://dev.to/dotnet/blazor-learn-to-get-the-best-of-both-worlds-with-javascript-interop-58pp %}

## -4- Routing in Blazor

Routing is an important topic. This article covers different types of routing and also covers router and query parameters.
{% link https://dev.to/dotnet/learn-how-you-manage-routing-in-blazor-for-net-core-and-vs-code-4m2e %}
Hello World!
Tags: helloworld, intro
Published: 2020-11-30 00:27:06

Greetings fellow internet citizens. Victor Lam here. First off, thank you for finding me here. I actually started this devlog on Medium, but wanted to move this over here since I hear it's both a more positive experience and more dev focused. I hope it helps you a bit as it’s helping me. How is it helping me you ask? Here are my goals for this dev log:

## Goal
* Post something every two or three weeks about what I learned about learning how to code.
* Use it as a personal journal about my progression. It just happens to be public!

## One thing though…
This is not a how to program tutorial or even someone starting from scratch. I’ve been coding in some fashion or another since the early 2000s! So why are you going to see a lot of fundamental thoughts? Well, that’s a story for another time. My goal for this post was to get a post about what I’m doing, otherwise, I can get rather long winded, so I’m editing myself down.

## tl;dr
Welcome and thanks for coming along the ride. I’ve set some personal goals for this blog and hope it helps you as much as it helps me!
How to identify my public IP from Linux CLI
Published: 2020-12-02 06:24:39

---
title: How to identify my public IP from Linux CLI
published: false
date: 2020-11-30 00:00:00 UTC
tags: 
canonical_url: https://glpzzz.dev/2020/11/30/my-public-ip-linux-cli.html
published: true
---

So easy!

```
dig +short myip.opendns.com @resolver1.opendns.com

```