Thursday, July 9, 2015

Probability Day 01

Rules probability must follow
  • The probability that nothing occurs is 0
  • The probability that something occurs is 1
  • The probability of something is 1 minus the probability that the opposite occurs
  • The probability of at least one of two (or more) things that cannot simultaneously occur (mututally exclusive) is the sum of their respective probabilities
  • If an event A implies the occurence of event B, then the probability of A occuring is less than the probability that B occurs
  • For any two events the probability that at least one occurs is the sum of their probabilities minus their intersection.
References
Brian Caffo, Jeff Leek and Roger D. Peng, Statistical Inference Lecture Notes, Johns Hopkins Bloomberg School of Public Health, coursera.org, 2015

Wednesday, July 8, 2015

Database Day 07: Relational Model

Major players in developing database software
  1. Oracle
  2. IBM
  3. Microsoft
  4. SAP
  5. Teradata
Data redundancy -> motivation behind the development of the relational model

The degree of relationship (also known as cardinality) is the number of occurrences in one entity which are associated (or linked) to the number of occurrences in another entity. There are three degrees of relationship, known as one-to-one (1:1), one-to-many (1:M) and many-to-many (M:M).

The degree of a relation: number of attributes in a relation.

Terminologies of a relational model: attribute, tuple.

A key is used to uniquely identify a tuple or a row in the relational model.

Superkey: an attribute or a set of attributes that uniquely identifies a tuple or a row.

Candidate key: a superkey such that no proper subset is a superkey within the relation. A candidate key K in relation R will have the following properties: uniqueness (i.e. for each tuple in R, the values of K uniquely identify that tuple) and irreducibility (i.e. no proper subset of K has a uniqueness property).

A Primary Key is defined as “A candidate key that is selected to identify tuples uniquely within a relation”.

Selecting Primary Key (PK):
– Choose the shortest candidate key.
– A number as it provides a more compact PK.

Foreign Key (FK): an attribute or a combination of attributes in one table whose values must either match the primary key in another table or be NULL.

Entity integrity
• Primary Key must not be NULL.

Referential integrity
• The values of FK must match the value of the PK in another relation or be NULL.

Column/Domain integrity
• All values in a given column must come from the same domain (the same data type and range).

EQUIJOIN: A join based on equivalence of a common attribute, with the join column appearing twice

NATURAL join: A join based on equivalence of a common attribute, with the join column appearing once

OUTER join: A join based on equivalence of a common attribute in which matched pairs are retained and any unmatched values in the other table are assigned nulls (may be left, right or full)

INNER join: A join that selects all rows from both tables as long as there is a match between the columns in both tables.

Data redundancy exists when unnecessarily duplicated data are found in the database.

Data independence is a condition in which the programs that access data are not dependent on the data storage characteristics of the data.

A DBMS is best described as a collection of programs that manage the database structure and that control shared access to the data in the database.

Structural independence exists when data access programs are not subject to change when the file's structural characteristics, such as the number or order of the columns in a table, change.

References
FIT5132 Introduction to databases lecture notes, Semester 2, 2014, Monash University.

Friday, May 15, 2015

Critical thinking skills Day 02

Elements of thoughts that are used for analysing our thinking

Figure 1: Purpose, goal, objective

Figure 2: Question at issue






Figure 3: Information, data, facts, observations, experiences


Figure 4: Interpretation and Inference (conclusions, solutions)


Figure 5: Concepts, theories, definitions, axioms, laws, principles, models

Figure 6: Assumptions, presupposition, taking for granted


Figure 7: Implications and Consequences

Figure 8: Point of View, frame of reference, perspective, orientation


References
Foundation for Critical Thinking https://www.criticalthinking.org/ctmodel/logic-model1.htm#

Wednesday, April 15, 2015

github basic commands DAY 01

1. git config --global user.name "mygithubuser"
2. git config --global user.email "mygithub_email_address"
3. Go to the folder where you want to save repo on your local machine
4. git clone https://github.com/yourgithubusername/your_repo_name
5. git status
6. git add your_modified_file (e.g. readme.md)
7.git commit -m "your descriptions of changes"
8. git remote add origin https://github.com/yourgithub_username/your_repo
9. git push -u origin master
10. git add .
11. git push
12. git pull origin master

Friday, January 9, 2015

Python programming Day 07

Python 3

#!/usr/bin/python3


1. Define classes

class Dog:
    def bark(self):
        print('Gau Gau Gau!')

    def swim(self):
        print('Swims like a dog.')

def main():
    nauvang = Dog()
    nauvang.bark()
    nauvang.swim()

if __name__ == "__main__": main()


2. Define and use a function
2.1
def main():
    testfunc()

def testfunc():
    print('This is a test function')

if __name__ == "__main__": main()

2.2
def main():
    print("This is the functions.py file.")
    for i in range(25):
        print(i, end = ' ')

if __name__ == "__main__": main()

3. Work with regular expressions

import re

def main():
    fh = open('toys.txt')
    for line in fh:
        if re.search('(Leg|g)o', line):
            print(line, end='')

if __name__ == "__main__": main()

4. Work with files

def main():
    f = open('readme.txt')
    for line in f:
        print(line, end = '')

if __name__ == "__main__": main()


Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...