Monthly Archives: May 2017

Weekly ML drop #11

I’ve become more and more interested in machine learning during last year. This is my way of collecting and sharing interesting reads on the topic I stumble upon. Those posts are published each Friday, they are divided into few categories and the format is constantly evolving. Last week I didn’t have time to prepare a weekly drop, so some “news” today may be a bit older.

News
In this part, I share interesting news from machine learning and artificial intelligence world. Those are mostly not very scientific articles about interesting applications,  predictions and controversies that AI causes.

Data is the new oil
In this very interesting article in The Economist, author bring arguments how in the 21st century, data will be (and already is) the main resource to fuel the economy (compared to 20th-century oil)

Sent to Prison by a Software Program’s Secret Algorithm
A man charged with fleeing police in a car was sentence 6 years in prison. One of the information used against him was set of bar charts analysing risks and threats he’s posing to the society. It wasn’t the main proof, but it is a little bit unsettling.

The parts of America most susceptible to automation
Short article discussion which areas of US and why will be most hit by the advent of automation. There’s interesting map there also.

Harnessing automation for a future that works
In this article, on the other hand, the author claims we’re not quite there, and we’ll need close cooperation between people and machines to progress automation.

6 areas of AI and ML to watch closely
If you’re interested what’s really hot in the industry, this article lists 6 most interesting technology areas.

Learning materials
Here I’m sharing material for learning ML that I found useful – online courses, blogs, books etc. This is usually rather technical stuff.

Deep learning simplified
Series of short videos explaining basic concepts of Machine Learning. Recommended rather for total beginners.

This is it for today, thanks for reading. If you liked the post, let me know and please check other parts of the series.

Phoenix, Ecto and time zones

This is another part of my series on learning Elixir.

In the previous episode, I calculated the distance of flight. I will use it later for gathering statistics. Another metric, I would like to have is a time of flight. Usually, flight departure and arrival times are presented in local time. So it gets a bit tricky to get the time length when the journey spans across few time zones.

Elixir’s standard DateTime library doesn’t work with time zones very well. The Internet suggests I should use Timex.

But first I needed to make some changes into my database because up until now, I had only flight date. A few weeks ago I wrote a post, how to update your schema with migrations and this time I followed the same steps. Still, I haven’t figure out how to do it in a bit more automated manner.

defmodule Flightlog.Repo.Migrations.CreateFlight do
  use Ecto.Migration

  def change do
    alter table(:flights) do
      modify :arrival_date, Timex.Ecto.DateTimeWithTimezone
      modify :departure_date, Timex.Ecto.DateTimeWithTimezone
    end
    
  end
end

As you can see, I used specific Timex types. This works only with Postgre, and if you want to use timezones it needs one additional step. You’ll have to add custom type to your database:

CREATE TYPE datetimetz AS (
    dt timestamptz,
    tz varchar
);

You can read more about using Timex with Ecto on this documentation page.

I also updated my flight.ex model. It looks like that right now:

defmodule Flightlog.Flight do
  use Flightlog.Web, :model

  schema "flights" do
    field :departure_date, Timex.Ecto.DateTimeWithTimezone
    field :arrival_date, Timex.Ecto.DateTimeWithTimezone
    field :flight_number, :string
    field :plane_type, :string
    field :from, :string
    field :to, :string

    timestamps()
  end

  @doc """
  Builds a changeset based on the `struct` and `params`.
  """
  def changeset(struct, params \\ %{}) do
    struct
    |> cast(params, [:departure_date, :arrival_date, :flight_number, :plane_type, :from, :to])
    |> validate_required([:departure_date, :arrival_date, :flight_number, :plane_type, :from, :to])
  end
end

After that, I walked along the path that’s proven to work in the flight distance part. I added a new function in my math.ex library, making use of Timex diff function:

    def flightTime(earlier, later) do
        hours = Timex.diff(later, earlier, :hours)
        minutes = rem(Timex.diff(later, earlier, :minutes), 60)
        "#{hours}:#{minutes}"
    end

And I’m calling it from the view in another function, so it’s easily accessible from the template:

  def time(time1, time2) do
    Flightlog.Math.flightTime(time1, time2)
  end

And that was it. Although it took me few hours because I was struggling a bit with Timex types. I didn’t read carefully the documentation and for example missed the step with creating new Postgre type. Good lesson here, to look into docs carefully :)

The effect:

 

Screen Shot 2017-05-07 at 23.26.43.png

As you can see, I made some approach at formatting dates. Unfortunately, I didn’t manage to show them in local time. They’re in UTC in here. This will be next step most likely.

That’s all for today. Next week we’ll try to test this new module. In the meantime, check previous episodesAnd if you’re interested in machine learning, look into my weekly link drop.

Weekly ML drop #10

I’ve become more and more interested in machine learning during last year. This is my way of collecting and sharing interesting reads on the topic I stumble upon. Those posts are published each Friday, they are divided into few categories and the format is constantly evolving.

News
In this part, I share interesting news from machine learning and artificial intelligence world. Those are mostly not very scientific articles about interesting applications,  predictions and controversies that AI causes.

Neuralink and Brain’s Magical Future
Tim Burton from Wait But Why wrote another lengthy article on one of the Elon Musk’s project. This time it’s about Neuralink, some sort of direct interface to the brain. Tim also tackled other AI-related topics, like Superintelligence, which is also a worthy read.

The Myth of Superhuman AI
Kevin Kelly, on the other hand, thinks that we’ll never get to superintelligence for those five reasons. Kevin was also mentioned in two weeks ago edition. I am currently reading his book and if you’re interested in future, it’s a must-read.

Software Predicts Cognitive Decline Using Brain Images
We talked several times about advancements in medicine, that Machine Learning brings. Image recognition algorithms are getting or surpassing human levels of detecting various threats to our health on diagnostic imagery. This article treats the topic of using a neural network to early detection of Alzheimer’s disease.

The first wave of Corporate AI is doomed to fail
The author of the article compares current wave of AI-advances to first booms of the internet and cloud computing, that failed miserably. Only after backing off and some advances those technologies hit a home run.

Waymo’s Self-driving cars will take first raiders
Alphabet’s self-driving cars company is going to run tests in Phoenix, including people outside’s of Google. People can sign up, and the rides will be for free. The goal is to check how people use and react to self-driving cars.

Learning materials
Here I’m sharing material for learning ML that I found useful – online courses, blogs, books etc. This is usually rather technical stuff.

Videos from ICLR conference has been published
International Conference on Learning Representations which took place in Toulon, France in late April, just published their video on Facebook.

Learning AI if you suck at math
This is a good article for total beginners, who not only do not have much experience in Machine Learning but also feel they’re lacking in math. It links to several good resources to jump up your algebra and calculus.

This is it for today, thanks for reading. If you liked the post, let me know and please check other parts of the series.