Python and Me.

Index

Since I wrote about Java, I’ll talk about Python. To be honest, I don’t like Python so much. (But I often use it.) In this post, I’m sure that the most important topic is “How To Become A Hacker”. Even if you don’t have a time, please read the topic at least.

 

blog.sun-ek2.com

 

 

↓ 日本語版。

blog.sun-ek2.com

 

What is Python?

f:id:sun_ek2:20181118141701p:plain

Python is one of the programming languagee. Its icon is really cute. I like the icon very much. Even if you don’t like pythons, or snakes, you would accept the icon.

 

I think Python is one of the easiest languages to study. I recommend Python for beginners. It’s simple but practical.

 

Python had already been a popular language. And as recently it has been used in the field of machine learning, it has been more popular.

 

It’s often said that Python is really slow. But the important parts for calculation are usually written C or C++.There’s no problem. But it’s true if Python didn’t obtain cooperation from C or C++, it would be really slow.

 

Python is simple. But I assume that Python largely relies on external libraries. (Library is a gathering of programs offers users convenient functions.) Perhaps Python itself is slow so its standard functions are not enough to make an efficient program. I think each external library has its own rules. So programmers have to learn not only Python grammar but also how to use the library. It’s a little troublesome...

 

Python is a dynamic typing language. (You can put any type of data in a box, such as number, word, and so on. And the type of data in the box is investigated later.) So when people (including me) who are familiar with static typing languages such as Java encounter an error about data type, it irritates them. (Static typing languages are the opposite of dynamic typing language. You are only allowed to put a specific type of data in the box.)

 

I think people whose major are biotechnology begin to think that programming skills are important for them and they get interested in Python. (My major is also biotechnology.)

 

 

 

My Python history.

When I was a high school student, …

I knew Python when I was a second-year student after I had given up studying Java. Though nowadays, Python 3 is often used, I started to study Python 2 since it was much popular than Python 3. I don’t know why I chose Java but I know why I started to study Python. The reason is important for me. So I’ll write about it later.

 

I borrowed a book at the library to study. The book, “Python Start Book”, is one of the famous serious for programming beginners released by Gijutsu-Hyohron Co. which is a Japanese publishing company. Also I studied CASLⅡ which is an assembly language with a book of the series.

 

I just read the book but after that, I hadn’t written any program in Python until I became a graduate student.

 

I am a graduate student, ...

I belong to a biological laboratory but the laboratory belongs to Graduate School of Information Science and Technology. I don’t know why. But because of that, it was easy for me to take information science classes. One of the class I took is machine learning. At the first class, I was told that all programming code introduced in the class was written in Python and I had to do your assignment by using Python. So I started to study Python again.

I bought a book, Introducing Python released by O'Reilly Media. (Strictly speaking, O'Reilly Japan) Actually I bought its Japanese version. I chose the book because it is released by O'Reilly Japan. Programming books of O'Reilly are famous and I often see the translations at book stores in Japan. The covers of the series stand out from others since realistic animals are drawn on them. I’ve been interested in these animals but I hadn’t interacted with them. So I picked up a realistic python, “Introducing Python” to read. (I forgot that I had interacted with them! When I was a third year student at university, I read an O'Reilly’s book about deep learning by halves.)

 

The title is Introducing Python but I think it isn’t for beginners. Are O'Reilly’s books for beginners anyway? I don’t think so. Sorry, it’s just my prejudiced view... But I recommend you to read this series after finishing a book for beginner. In addition, his book includes some goods jokes. I like them. (Perhaps, these kind of jokes are not special? Actually, books written by Japanese author include a few jokes?)

 

 

Computer programs I’ve developed.

When I was a high school student, I study Python but didn’t write a program in Python. These following programs have developed at graduate school.

 

SVM for evaluating the difficulty of English words.

This is an assignment of the machine learning class I took. SVM is an abbreviation of Support Vector Machine. I used scikit-learn which is a famous machine learning library. The assignment was to train SVM by using a given data set including 20 thousand English words and their difficulties presented by numbers. But of course, it was not enough to train SVM. So I needed to define how to evaluate the difficulties of English words and to expand the training data. For example, length, number of syllables, frequency of use and so on.

 

I assumed that an English word with the low number of hits by search engine such as Google, Bing, Yahoo! were difficult. Based on the hypothesis, I wrote a program to collect each number of hits of 20 thousand words and it went well. Though it was the SVM assignment, I submitted the program whose large part consisted of lines for scraping.

 

CNN for recognizing images.

This is also an assignment of the machine learning class. CNN is an abbreviation of Convolutional Neural Network. It’s often called deep learning. The assignment was to train CNN by using tens of thousands of image data and to classify given test data into 200 categories.

 

I wrote a program but it produced miserable result... The accuracy rate was about 5%. I used TensorFlow which is a machine learning library developed by Google. I’ve used it but I need to spend more time in learning TensorFlow to use effectively. It was difficult for me.

 

I couldn’t handle queue runner. Queue runner picks up some of data randomly and make a batch to feed CNN. (It prevents CNN from trapping a local minimum of a loss function. If you have an interest in it, please read some articles about stochastic gradient descent.) In the end, I wrote code like queue runner. But definitely, queue runner is much more effective than my code...

 

After training phase, I couldn’t set a parameters to CNN for testing. So after training, I didn’t save parameters and proceeded with testing immediately.

 

The performance of my PC is not enough to train CNN. My PC is equipped with only 4 GB of RAM so my computer was always crashed during the training. Eventually, I borrowed a PC to train my model.

 

I want to study TensorFlow again to handle, not just use it. I have a little interest in Chainer. It’s a deep learning framework made in JAPAN.

 

But firstly, I want a new PC which isn’t crashed anyway!!

 

Programs for data analysis.

I won’t explain it in detail. I may not. If I explained, it would not be worth getting to know it. They’re just data analysis programs. It’s easy to write such programs by using Python. I write a few line to draw a graph.

 

 

 

How To Become A Hacker

How To Become A Hacker

I studied Python because I had read this article. In this article, Python is introduced as one of the languages for beginners. I was most influenced by this article in my high school days.

 

Originally “Hacker” isn’t a bad meaning, just to make sure. Hacker is the best phase to show respect to a genius programmer. Cracker is a parson who gains unauthorized access to other’s computer, not hacker. Maybe a criminal said,” I’m a hacker. (= genius programmer)” And people have misunderstood the meaning. (Hacker is criminal)

 

According to the article, the difference between a hacker and a cracker is...

Hackers build things, crackers break them.

 

The hacker attitude introduced in the article can be applied not only to IT but also to any other fields. It’s worth reading. It’s said that the hacker spirit can be found at the highest levels of any fields.

 

I think scientists are similar to hackers. I’ll foster my hacker spirit as a scientist.