Skip to content

Instantly share code, notes, and snippets.

View ijharulislam's full-sized avatar

ijhar ijharulislam

  • Full-stack Web Developer
  • Dhaka, Bangladesh.
View GitHub Profile
from __future__ import unicode_literals
from django.db import models
from django.db.models import Q
from financial.models import Tax
from django.contrib.auth.models import User
class BaseClass(models.Model):
created_on = models.DateTimeField(auto_now_add=True, null=True,blank=True)

A Few Useful Things to Know about Machine Learning

The paper presents some key lessons and "folk wisdom" that machine learning researchers and practitioners have learnt from experience and which are hard to find in textbooks.

1. Learning = Representation + Evaluation + Optimization

All machine learning algorithms have three components:

  • Representation for a learner is the set if classifiers/functions that can be possibly learnt. This set is called hypothesis space. If a function is not in hypothesis space, it can not be learnt.
  • Evaluation function tells how good the machine learning model is.
  • Optimisation is the method to search for the most optimal learning model.
# import urllib
# import urllib2
from datetime import datetime
import xlrd
from lxml import html
from bs4 import BeautifulSoup
import xlsxwriter
import re
from selenium import webdriver
<div class="panel-form post-contacts">
<button type="button" ng-click="showAnyModal('confirm_modal')" class="close cros-button"><span aria-hidden="true">&times;</span></button>
<form name="postContactForm" id="form-contact" novalidate>
<h3>Basic Info</h3>
<div class="row">
<div class="col-xs-6">
<div class="info-elements">
<label>
<span>First Name </span>
<span style=" color: #ff9100">*</span>
with open('TestReport.csv', 'w') as f:
dict_writer = csv.DictWriter(f, data[0].keys())
dict_writer.writeheader()
dict_writer.writerows(data)
with open('%s'%file_name, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
raw_data = {
'shops_root_url': row['Shops_root_url'],
from elasticsearch_dsl import Search, Q, query as dslq
from app import es
targetings = [
{
"field": "country",
"operator": "NOT IN",
"value": "BD"
},
import os
file = os.path.expanduser('~')+"/.bashrc"
environs = [
"DB_NAME=db",
"DB_USER=db_user",
"DB_PASSWORD=password",
"SECRET_KEY='your secret kye here'",
"DEBUG=False",
import urllib.parse
import urllib.request
import json
input_data = {
'format': [
{'item_name': 'name', 'xpath': '//*[@id="storeMap"]/header[3]/div/h2/text()', 'regex_match': 'Null', 'regex_item': 'Null', 'remove_tag': ''},
{'item_name': 'zip', 'xpath': '//*[@id="storeMap"]/section/div/div[1]/dl/dd[1]', 'regex_match': '〒([\\d\\-]+)', 'regex_item': '$1 ', 'remove_tag': ''},
# {'item_name': 'address', 'xpath': '//*[@id="storeMap"]/section/div/div[1]/dl/dd[1]', 'regex_match': '〒[\\d\\-]+<br>([^<]+)', 'regex_item': '$1 ', 'remove_tag': ''},
import selenium
from selenium.webdriver.common.proxy import *
from selenium import webdriver
PROXY = "5.101.218.179:8085"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
driver = webdriver.Chrome(chrome_options=chrome_options)