Posts

Showing posts from 2018

Triggers in MySQL

Image
Trigger MySQL: Trigger can be used in two ways with before and after with Delete ,insert and update command .Let me show you a example of before update   . I have created two table employee and employee_audit . employee table is table where my raw data will be stored and employee_audit table is table where to store data after changes or can say trigger execution . Table structure of employee and employee_audit table : CREATE TABLE   `test`.`employee` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(20) DEFAULT NULL,   `lstname` varchar(10) DEFAULT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; CREATE TABLE   `test`.`employee_audit` ( `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(20) DEFAULT NULL,   `lstname` varchar(20) DEFAULT NULL,   `action` varchar(50) DEFAULT NULL,   `upd_datetime` datetime DEFAULT NULL,   `newname` varchar(20) DEFAULT NULL,   `newlstname` varchar(20) DEFAULT NULL,   PRIMARY KEY (`

Machine Learning : Cross Validation Technique

Cross validation is one way to avoid over fitting of data in machine learning . Cross validation works in such way : 1st Way : One Round Cross Validation :   in this data is divided into  50-50 portion ,one portion is for test set , one portion is validation of model that is prepared with the help of 50% of data . Leave one out cross validation(LOOCV)  : In this ,we leave one data set for cross validation  and rest data set for use for training of model . k-fold cross validation : In this k data set are used to trained  the model ,while k-1 are using for validate or test  the model .

Machine Learning 1

Image
Machine Learning : if you talk about artificial intelligence , then Machine learning is one way to feed artificial intelligence to obtain intelligence in making decision . Machine learning use statistics ,algebra ,probability and other mathematical related algorithm. so there is always question ,what we should  do to   use machine learning in daily life ,because if any where you are working ,you can use  AI ,but for that you should know Machine Learning ,Deep learning and Python programming and logic to fit all these in a pattern . so first we will go with machine learning basic concept : machine learning use  training data for making algorithm to predict future decision or daily routine decision . enough past data is feed into training set to make algorithm. Machine Learning information can be divided into following categories : 1: Unsupervised learning . 2: Supervised learning  3: Semi Supervised learning    Unsupervised learning  : When learning data contains o

Logging in Python .

Python logging is as much important for python as flavours in Ice Cream , lies in politics and life without goal .without flavour ice cream means ,it may be tasty for you but not for others ,so  a programme should be like that it should be understandable by others .Logging is used for log purpose of a programme ,what actually it is doing .lies in politics means you can not grow your code without logging otherwise ,it is very difficult to track your programme . So before further moving we can see .where logging can be used . 1: Displaying a information of  programme . 2: Issuing a warning . 3: Catching  a error . 4: Catching Critical information . How we can  achieve by python logging: So for achieving we need to know  ,level in python ,mostly 5 type of level are used in python DEBUG,INFO,WARNING ,ERROR and CRITICAL .let's elaborate what actually each level means in python . DEBUG : Debug we used for diagnostic purpose or detailed information . INFO     : Programme is w

Python : Working With File and Directory

Q: How to list all files From a directory ? Ans : You Can do it any many way ,  mentioned  are  some way 1st way: import os for file in os.listdir("C:/ra"): if file.endswith(".gz"): print(os.path.join("C:/ra", file)) # 2nd way: import glob, os os.chdir("C:/ra") for file in glob.glob("*.gz"): print(file) # 3rd way: import os for root, dirs, files in os.walk("C:/ra"): for file in files: if file.endswith(".gz"): print(os.path.join(root, file)) Q: How to unzip gz file into normal . Ans : import shutil with open('C:/xyz.xml', 'rb') as f_in, gzip.open('C:/xyz.xml.gz', 'wb') as f_out: shutil.copyfileobj(f_in, f_out)

Install Mysql from ZIP without MySQL Installer or Exe

Image
How to install MySQL from Zip file . Step1 : Download  MysSQL   from  myql  website ..    Download From Here you will see  mentioned  folder  and  file .except red circle folder ,that I have  created manually  . Data: for storing database file . error: for storing error  log . tmp: it need to  for installation  of myql Step  2:  now create  a configuration file  my.cnf(linux)  ,my.ini (windows) . Mandatory configuration parameter that need to include in your file as shown . Step 3 : Now  Need to initialize  mysqld  by mentioned any of command .         mysqld    --initialize         mysqld    --initialize-insecure In my case first command did not  work properly  ,but 2 nd command work file ..  ,now  I am telling difference between these command . , first command will generate a  secure key for connecting mysql  but 2 nd command will let you intilize mysql  without password , you can generate it letter  my mentioned command Alter user  ‘root’@’localhos