## Multi-variable linear regression

I continue working with machine learning algorithms. In a previous post I talked about linear regression with one variable and I described different algorithms to predict hypothesis.

In this case, I’m playing with linear regression but, with some features. Linear regression only have one input feature and one output feature. For example, you can predict the price of a house give the house’s size. But imagine that you want predict the price of a house using size and rooms features. When you have more than one input feature is called ‘multi-variable linear regression’.

In the following figure we can see the two input features (size and rooms), the training data (red dots), and the predictions (blue dots). In this case, we can represent the information with a 3D model. If your model have more than three features you must research the way to represent all the data.

by

## Playing with machine learning: Linear Regression

Since two months ago I’m researching about machine learning and its algorithms. The goal is get a good unsupervised and clustering algorithm to analyze every android applications and predict what application you want to install or use in a particular time. The first step is learn and understand the theory of machine learning. For this,  I began to study the Machine Learning Course of Stanford. It’s a great and practical course with videos and material to help understand the classes.

The first model that I have studied is linear regression. This model consist in have a relation between two or more variables. For example, in my example I have a training data about the prices of the houses and its size in square meters. This training data is used to build a linear regression model to predict the prices of the house give the size of the house. As you  can see in the following figure, the black dots show the training data (I did web crawling to get real data). The blue line represents the trend line of the model, and the red dots show the predicts for two size of houses.

by

## How decompile an Android Application

Decompile is a process to revert the compile operation. I main, decompile converts the low level code in high level code. The Android application is compiled in APK container that groups files as: xml, images and class. APK containers are actually ZIP containers. An interest thing is can see the xml configuration or some source code of others applications. If this applications are Free Software is not a problem, but if this applications are privated we can’t see its configuration. The next application help you to decompile an APK file to see xml configuration and source code.

Some tools I’ve found:

by

## The first prototype video of ESTUFA

ESTUFAÂ is a framework that provides several ways to connect and re-use mobile applications (in previous post I already presented this idea). The system allow build “execution chains” to connect and plumb two applications.

This project is based in the idea of re-use and compose new applications using components (in this case Alchemist). It has a strong context with “end-user software engieneer”, we want implement a solution from end-user non-developers to build new applications without technical knowledge.

See the video to know how it’s possible connect IO FileManager with Twitter or GMail. For this, we use an execution chain that create a file zip from files of File Manager, upload it to dropbox, obtains a tiny URL pointing to dropbox and finally send this url to GMail or Twitter.Â The power ofÂ ESTUFAÂ resides in its alchemists and the compatibility between these and applications.

If allÂ goes well, thisÂ project will beÂ my PhD thesis over the nextÂ 2 years 🙂

by

## Arduino & Android & ADK

The last Google I/O a new feature based in Android and Arduino was released. The ADKÂ allows the communication between Android and Arduino using a USB connection. Google have developed a library called “USB Accessory” in Android and Arduino. So, this library help us to send and receive dataÂ through USB interface.Â Using the USB accessory we can control the Arduino board. We can power-on or power-off leds, servos, components and read the data of sensors (temperature, humidity, movement, etc).

The next video shows how is possible read/write an analog I/O (values between 0 and 1023) and read/write digital I/O (values 0 and 1). We have connected three leds to digital outputs and one potentiometer in an analog input. The potentiometer simulated all possibles values (0-1023 ~ 0-5v).

Arduino Source Code: ExampleBoardArduino.zip

Android Source Code: ExampleBoard.zip

by

## New challenges about Android, AR and Arduino

During the next months I will work in three interesting topics. The first of them is the creation of a new architecture based in Android that allow communicate and integrate applications. The second Â is the port ofÂ ARviewerÂ to iPhone platform using phoneGap. And the last oneÂ is the very well-know Arduino and itsÂ possibilities with Android USB Host.

Some months ago we have started to developed a new idea about “create new android apps easily”. The magic idea is that the user can connect two o more applications with “connectors” (your way),Â although this applications haven’t been developed for that purpose. For example, imagine that you can (as user) configure twitter to show the all contents in ARviewer application, or you can configure to show this twitts in an amazing map. The developers don’t know the use of his data, only they configure some outputs and inputs and the final user is the responsible of link this applications. Numerous filters also are incorporated into the platform, so the final user can modify the data exchanged between applications. All the ideas are early but I wish tell you in more detail in theÂ nextÂ posts.

Currently, ARviewer is the best FLOSS augmented reality viewer. The last year, we began the port of ARviewer to other platforms (iPhone) using a multi-platformÂ framework. In theÂ previous post I talked about the implementation in Android using PhoneGap. In short, we will have the development completed to run in iPhone platform. Some people have shown interest about this project, so we are very exciting about this and we are looking forward to show our work!

Google announced Â in the last Google I/O a new feature:Â Android Open Accessory Development Kit. The new amazing feature allow communicate the Android devices with the Arduino boards using a USB HOST! This is a cool idea! New projects are shaping up using this technology to communicate micro-systems with Android devices. For example, imagine a little electronic circuit with Arduino that control a cooling system. You could connect your android phone to Arduino board to control andÂ recollectÂ all the information about the system. See an example of this idea [video]

The next 6 months I will work in these topics, so I wish tell you all the results about this interesting topics before the end of the year!

by

## Distributed Video Surveillance System based on Android

Security and Surveillance Systems have always been demand in the industrial and home environment. The cameras, which human eyes are able to collect all visual information from the environment. Extensions necessary and highly desirable in these systems, and that few possess, are integration and interconnection with other systems, video surveillance and display all the information on a mobile device, which lately is becoming essential in a peripheral daily life. Most existing surveillance systems are based on the hardware, and software is old and have not a good design, so it’s difficult allowing scalability and increased functionality.

This project, called Surveillance, raises the development of a distributed video system integrated in mobile device based on Android. For this we have designed a distributed system, multi-platform, multi-lenguage and high scalability. The system performs records through the cameras installed and it is associated with an alarm generation by motion detection. All this is managed and viewed from a mobile device based on Android with intelligent touchscreen. One of the most important features has been developed is receiving real-time video in mobile device, both the cameras and recordings made.

The system has been experimentally validated and proven correct operation. For the implementation of this project is used software platform architecture and JDEROBOT, distributed component programming six main functions that are: get the images from the camera, motion analysis, centralize the management of the recordings, making the recordings, display information on mobile and manage logical recordings and alarms. It has also opted to use frameworks, consolidated libraries and tools (ICE, GStreamer and VLC) to provide robustness to the system. Finally, we have integrated and improved several components of this infrastructure, obtaining a correct and efficient functioning.

Of sourse, this project is a FLOSS (Free Libre Open Source Software) project. You can obtain the source code and documentation in the next links:

by

## ARviewer, PhoneGap and Android

Three months ago I wrote a post describing the plan that RaÃºl Roman and I are involved: build an augmented reality interface using PhoneGap. Today, we have uploaded a beta version (0.1.0) of ARviewer-PhoneGap to Android Market. This version works fine and shows the geolocated nodes obtained from libregeosocial server. The next steps are:

• We test this source code in IOS platform to check the real portability that phoneGap provide us.
• We plan to add the “tagging mode” with phoneGap to allow tag new nodes/objetcs from the mobile.

Are very very similar the next images, right? Only we have found a critical problem with the refresh of nodes in the WebView using PhoneGap. We will study and analyze thisÂ behavior.

ARviewer PhoneGap

ARviewer Android (native)

Source Code (GPL):Â http://git.libresoft.es/ARviewer-phoneGap/

by
Posted in Uncategorized | 2 Comments

## Kinect’s depth map on your Android device

Two weeks ago, I have received the new fashion gadget of Microsoft: the kinect sensor. Thanks for the community (libfreenect), this sensor designed for Xbox can be used in GNU/Linux systems. Lately I have the need of integrate anything with Android mobile (is it becauseÂ I haveÂ over 3Â years programming with Android?) So, I couldn’tÂ pass upÂ thisÂ opportunity!

Using JDEROBOT (a distributed framework to programmingÂ behaviorsÂ robotic) and ICE (Internet Communications Engine) is possible show the images of kinect in an Android mobile. Using the mobile we can see the normal image, the depth image, control the tilt movements and play with the leds. For this, it’sÂ necessary connect the kinect to PC with jderobot running and the android mobile access to PC using wifi connection to obtain all the date and images.

Soon, all source code will be FLOSS, meanwhile you can see the next video.

by

## AR interface in Android using phoneGap

Since 6 months ago we have evaluated the possibility to implement a new AR interface (based in our project ARviewer) using phoneGap. phoneGap is a mobile framework based in HTML5/JS that allow execute the same source code HTML5 in differents mobile platforms (iphone, android, blackberry). It seem a good way to create portable source code. Since 3 years ago I work in this project with RaÃºl RomÃ¡n, a crack coder!!

Currently using phoneGap is not possible obtain the stream camera in the webView widget. So, this part of the source code must be developed in the native platform. We find another problem. We couldÂ notÂ put the webview transparentÂ so it would lookÂ the cameraÂ inÂ theÂ background, and paintÂ objects on top with HTML. In this case, we asked for this to ï»¿David A. Lareo (Bcultura) and Julio ï»¿RabadÃ¡n (Somms.net) and gave us some very interesting clues about this problem.

The solution is implemented in the source code that you can see below. It’s necessary that our main view (R.layout.main) is the main view, for this we do ‘setContentView’ and later we add the main view of ‘DroidGap’ using ‘addview’ and ‘getParent’. Once weÂ haveÂ our view mixed with phonegap main view, we set the backgroundColor transparent.

```    @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();

setContentView(R.layout.main);
RelativeLayout view =Â (RelativeLayout)
findViewById(R.id.main_container);

// appView is the WebView object
View html = (View)appView.getParent();
html.setBackgroundColor(Color.TRANSPARENT);