Python and PHP: A comparison of the language basics

In this table I will compare some basic programming syntax and conventions between the Python and PHP programming languages. Programming element Python PHP Code commenting PHP supports Python and JavaScript conventions # Single line comment “””This is a multi-line comment block. This is a multi-line comment block.””” # Single line comment // Single line comment/*This … Continue reading Python and PHP: A comparison of the language basics

Data Science: How to calculate confusion matrix

In Data Science, the confusion matrix is a measure of the health of a model. In particular, it helps to measure the performance of a supervised learning model. For this article, I will detail how to create a confusion matrix for a binary classification model both manually and using an sklearn built-in function called metrics.confusion_matrix. … Continue reading Data Science: How to calculate confusion matrix

Python and Ruby: A comparison of the language basics

In this table I will compare some basic programming syntax and conventions between the Python and Ruby programming languages. Programming element Python Ruby Commenting code: Both use the pound # sign. # This is a comment # This is a comment Multi-line comments: “”” This is a comment. This is a comment, too. This is … Continue reading Python and Ruby: A comparison of the language basics

Python: How to read and write JSON

JSON is a lightweight data-interchange format that stands for JavaScript Object Notation. It so happens that JavaScript objects look exactly like Python dictionaries, so JSON objects can be thought of as portable dictionaries of key-value pairs. This portability is what makes JSON so valuable. While JSON objects can be identical to Python dictionaries, there are some … Continue reading Python: How to read and write JSON

Python and JavaScript: A comparison of the language basics

In this table I will compare some basic programming syntax and conventions between the Python and JavaScript programming languages. Programming element Python JavaScript Creating a variable that contains an int: age = 25 var age = 25; Creating a variable that contains a float: probability = 0.62 var probability = 0.62; Creating a variable that … Continue reading Python and JavaScript: A comparison of the language basics