Archiv für Dezember 2011
(English) How to setup a local DBPedia Live mirror
Veröffentlicht von dakoller in Semantic Web am 6. Dezember 2011
This blog describes how you can setup a local DBPedia Live mirror on your own machine based on the official DBPedia downloads.
What is DBPedia?
DBPedia aims to extract structured information from the unstructured data source Wikipedia, which is used by millions of people on a daily basis to lookup information in a very current manner. (Research shows that Wikipedia is regularly one of the fastest updated information sources when any kind of event happens).
Wikipedia itself is a wiki-based system, so anybody can insert any kind of unstructured information, but sometimes you require structured information e.g. to get a list of location, persons etc.: this is where DBPedia comes into the game.
DBPedia uses configurable information mappings to extract RDF-formatted information from the Wikipedia infoboxes. this extraction happens every 3-4 months, in the meantime the DBPedia content does not change.
(DBPedia is a project managed by the university of Leipzig, Free University of Berlin and Openlink SW. Find more information on the DBPedia Imprint )What is DBPedia Live?
DBPedia Live adresses the need for more current information based on the wikipedia sources: it applies the information mapping framework to recently changed Wikipedia articles and updates the information.
DBPedia Live itself provides an SPARQL-based endpoint, but for own use cases and applications you might be interested in an own SPARQL endpoint.
The DBPedia team provides a synchronization tool to keep the local mirrors in sync with the “mothership”: the tools downloads additions, changes & deletions and applies them to your local RDF store.
Which infrastructure is needed?
I installed the software on a virtual Ubuntu Server 11.10 (64-bit version): the virtual machine has 100GB of storage. (You better take a little bit more space if you can)
Installation steps
- After Ubuntu server installation you need first to install the OpenLink Virtuoso Server (in the non-cluster-enabled open source version, which is free). Please take care of the note at “Package Contents and Layout”: the script provided by DBPedia refers to the “isql” command, which needs to be replaced with “/usr/bin/isql-vt”.
- Start downloading the initial data seed from DBPedia Live at http://live.dbpedia.org/dumps/: you should download the latest file named with a date. (the download is ~2.7GB in zipped version: so usage of a download manager such as KGet on Ubuntu is a good idea, this means a 30GB un-zipped file on your disk)
- Download the synchronization tool from http://sourceforge.net/projects/dbpintegrator/files/ . The synchronization tool includes the virtload.sh script, which is essential to upload the DBpedia content to the local RDF store.
- The virtload.sh script does the following:
- it unzips the DBPedia file if needed,
- in case it is large the file is sliced into small pieces of 50k lines of text each. (In case you want to use the file for e.g.another RDF store, please make sure to keep the lines intact: the n3-format of the triples if broken if you mix up the text lines)
- later each sliced file is uploaded.
- Take care to adapt the script at least regarding the “isql-vt”-issue mentioned before.
- You need to start the virtload-script by ”virtload.sh <triple-file> <graph name, e.g. http://live.dbpedia.org> <port, regularly 1111> <username, e.g. dba> <password>.
- the graphname allows you to structure the namespace in the RDF store.
- the standard username is dba,
- the password for the dba user is assigned during the Virutoso install process.
- Wait…
I am currently at step 6:
the machine runs since 1,5 days and has approx. 25% of the task done. To avoid any interruptions you should make sure that the process can run day & night: the script can only be executed completely in one step. Also make sure that the harddisk has some free space all the time.
7. Adapt the synchronzation tools configuration files according to the readme.txt files.
8. Start the synchronization tool and make it regular shell scipt via e.g. a cron entry.
Already during the import process you can use the SPARQL endpoint,e.g. to check information of Berlin (or http://dbpedia.org/resource/Berlin in DBPedia speak).
Special kudos for putting together the very helpful DBPIntegrator package goes to Mohamed Morsey from the Leipzig university staff.
Was macht eigentlich ein Data Scientist?
Veröffentlicht von dakoller in data science, Uncategorized am 5. Dezember 2011
In diesem Blog geht es darum zu klären, was hinter der Bezeichnung Data Scientist steckt, die in den USA bereits am stärksten präsent ist, aber auch im Rest der Welt an Bedeutung gewinnt.
Der Data Scientist beschäftigt sich mit der Beschaffung, Auswertung, Interpretation und Visualisierung von Informationen, die entweder innerhalb von Organisationen/Unternehmen entstehen oder die für sie relevant sind.
Die Geburtstunde der Data Science ist nicht klar festgelegt: eine der frühesten industriellen Anwendungen ist das “Kunden, die diesen Artikel gekauft haben, kauften auch …” Feature von Amazon: das habt Amazon geholfen, Kunden die eigentlich nur einen Artikel kaufen wollten, zwei oder mehr Artikel zu verkaufen.
Warum kommt dieses Thema jetzt?
Bei dem Begriff Data Scientist kommen zwei Entwicklungen zusammen, die jetzt in Kombination für – sagen wir mindestens mittlere und große Unternehmen relevant sind.
Zum einen kommen aus den Tools, die wir nutzen, eine immer größere Informationsmenge: denken Sie zum Beispiel an die Informationen, die hinter einem Klick auf einen Facebook “I like”- Knopf stehen können. Das sind
- die Informationen über Sie als Nutzer,
- ds Objekt, das Sie “mögen”,
- den Kontext des Klicks (wann klicken Sie, was haben Sie vor dem Klick gemacht und was danach), und
- in welchem Ausmaß Sie dabei mit Ihrem sozialen Netzwerk agieren.

Wozu braucht man den Data Scientist?
- Mustererkennung in Transaktionen,
- Zeitreihen-Betrachtungen, um z.B. saisonale Muster zu erkennen und
- Auswertungen, mit welcher Wahrscheinlichkeit ein bestimmtes Ereignis für eine Zielgruppe eintritt.
- Welche Artikel können zusammen angeboten und werden zusammen gekauft?
- Wieviele Schneeschaufeln müssen vorraussichtlich Ende Januar noch bestellt werden?
- Welches Verpackungsdesign spricht die Konsumenten am besten an?
- aus den ihnen zur Verfügung stehenden Daten (ggf. mit Berücksichtigung freier Daten von Behörden und Regierungen)
- Fragen zu formulieren, die den Einfluss auf das eigene Geschäft abbilden,
- diese Fragen mit einem Methoden- und IT-Werkzeugkasten zu beantworten und ggf.
- die Ergebnisse zu visualisieren, so dass ein Unternehmensvorstand daraus Handlungsempfehlungen entnehmen kann.
Was muss der Data Scientist können?
- Er muss zuhören & beschreiben können, wo der Schmerzpunkt des Kunden genau liegt, um herausfinden, welche Fragestellungen für eine Projekt am schnellsten zu Handlungsempfehlungen führen und welche Daten man dafür nutzen kann.
- Er muss das mathematische & statistische Handwerkszeug beherrschen und Algorithmen entwickeln, um keine Zeit beim Ausprobieren untauglicher Methoden zu verlieren.
- Er muss die IT-Werkzeuge so gut beherrschen, dass er sie schnell in den Prozess einbauen kann, der für die Lösung des Problem gebraucht wird. (Die Integration aller Werkzeuge heute noch eine manuelle Aufgabe für den Auswertenden ist)
Das kann man noch mit ein paar knackigen Anforderungen beschreiben:
In diesem Blog geht es darum zu klären, was hinter der Bezeichnung Data Scientist steckt, die in den USA bereits am stärksten präsent ist, aber auch im Rest der Welt an Bedeutung gewinnt.
Der Data Scientist beschäftigt sich mit der Beschaffung, Auswertung, Interpretation und Visualisierung von Informationen, die entweder innerhalb von Organisationen/Unternehmen entstehen oder die für sie relevant sind.
Die Geburtstunde der Data Science ist nicht klar festgelegt: eine der frühesten industriellen Anwendungen ist das “Kunden, die diesen Artikel gekauft haben, kauften auch …” Feature von Amazon: das habt Amazon geholfen, Kunden die eigentlich nur einen Artikel kaufen wollten, zwei oder mehr Artikel zu verkaufen.
Warum kommt dieses Thema jetzt?
Bei dem Begriff Data Scientist kommen zwei Entwicklungen zusammen, die jetzt in Kombination für – sagen wir mindestens mittlere und große Unternehmen relevant sind.
Zum einen kommen aus den Tools, die wir nutzen, eine immer größere Informationsmenge: denken Sie zum Beispiel an die Informationen, die hinter einem Klick auf einen Facebook “I like”- Knopf stehen können. Das sind
- die Informationen über Sie als Nutzer,
- ds Objekt, das Sie “mögen”,
- den Kontext des Klicks (wann klicken Sie, was haben Sie vor dem Klick gemacht und was danach), und
- in welchem Ausmaß Sie dabei mit Ihrem sozialen Netzwerk agieren.
(Mehr zum technischen Hintergrund des “I Like” gibt es in der https://developers.facebook.com/docs/reference/plugins/like/ ).

Wozu braucht man den Data Scientist?
- Mustererkennung in Transaktionen,
- Zeitreihen-Betrachtungen, um z.B. saisonale Muster zu erkennen und
- Auswertungen, mit welcher Wahrscheinlichkeit ein bestimmtes Ereignis für eine Zielgruppe eintritt.
- Welche Artikel können zusammen angeboten und werden zusammen gekauft?
- Wieviele Schneeschaufeln müssen vorraussichtlich Ende Januar noch bestellt werden?
- Welches Verpackungsdesign spricht die Konsumenten am besten an?
- aus den ihnen zur Verfügung stehenden Daten (ggf. mit Berücksichtigung freier Daten von Behörden und Regierungen)
- Fragen zu formulieren, die den Einfluss auf das eigene Geschäft abbilden,
- diese Fragen mit einem Methoden- und IT-Werkzeugkasten zu beantworten und ggf.
- die Ergebnisse zu visualisieren, so dass ein Unternehmensvorstand daraus Handlungsempfehlungen entnehmen kann.
Was muss der Data Scientist können?
- Er muss zuhören & beschreiben können, wo der Schmerzpunkt des Kunden genau liegt, um herausfinden, welche Fragestellungen für eine Projekt am schnellsten zu Handlungsempfehlungen führen und welche Daten man dafür nutzen kann.
- Er muss das mathematische & statistische Handwerkszeug beherrschen und Algorithmen entwickeln, um keine Zeit beim Ausprobieren untauglicher Methoden zu verlieren.
- Er muss die IT-Werkzeuge so gut beherrschen, dass er sie schnell in den Prozess einbauen kann, der für die Lösung des Problem gebraucht wird. (Die Integration aller Werkzeuge heute noch eine manuelle Aufgabe für den Auswertenden ist)
- Aus der Unternehmensberatung: Workshops durchführen, Projekt-Scope festlegen können, Anforderungsanalyse (und ggf. -priorisierung) durchführen, Meilensteine und Endergebnisse definieren.
- Aus der Mathematik und Statistik: lineare, logarithmische und non-lineare Regression, Zeitreihenanalyse, Varianzanalyse, Faktoren- und Clusteranalyse, neuronale Netze und Korrespondenzanalyse (und noch viele mehr)
- Aus dem IT-Bereich: Statistische Tools wie R,SAS und/oder MATLAB, Machine Learning-Algorithmen und Tools, z.B. Apache Hadoop, Cloud-Infrastruktur-Kenntnisse, Tools zur Informationsmodellierung, Tools zur Visualisierung (z.B. ggplot, Processing.JS)
Angrenzende Gebiete
- Datenjournalismus: Dabei verwenden Journalisten Datenquellen mit ähnlichen Zielen wie Data Scientists mit der Öffentlichkeit als Zielgruppe, der Fokus liegt hierbei auf Informationsgewinnung aus öffentlichen Quellen (Web Scraping sei als relevanteste Anwendung genannt) und Visualisierung. Ich sehe dabei den Guardian in Grossbritannien als führend an, im deutschsprachigen Bereich ist auch die ZEIT in diesem Thema unterwegs.
- Open Data: Wenn Fragestellungen nicht allein mit den unternehmenseigenen Daten beantwortet werden, können Daten von Behörden und regierungen Ansatzpunkte liefern. In Deutschland läuft die entsprechende Bewegung unter dem Schlagwort Offene-daten.de , ein weiteres prominentes Beispiel ist data.gov.uk, das Angebot der britischen Regierung.
- Semantic Web/Linked Data: Das Semantic Web oder spezieller die Linked Data-Bewegung beschäftigt sich damit, Zusammenhänge zwischen Objekten in Form öffentlicher Ontologien zu beschreiben und so wiederverwendbar zu machen. Die Relevanz zum Thema Data Science ergibt sich aus der Tatsache, dass nicht immer statische Verfahren allein ausreichen, um Phänomene zu erklären, wenn sie kausal nicht herleitbar sind. Linked Data Quellen ermöglichen diese basierend auf technischen Standards in den Auswertungsprozess einzubeziehen. Linked Data tritt auch gemeinsam mit Open Data auf, das ganze heisst dann Linked Open Data.
(English) First steps with Google’s Prediction API – Part 1: Data Preparation, Upload & Training
This blog shows an example how to work with Google Prediction API on a standard classification example: it is based on the currently running “Give me some credit exercise”from kaggle.com. The example case wants to know (based on a set of defined input variables, how big the probability is that a certain person will go into insolvency during the next two years.
This first part covers data preparation, upload & training preparation, the second part will cover training & prediction with Google’s API and the third part will contain a summary & a recommendation on when & how Prediction API can be used.
Steps needed to use Prediction API
0) Prepare your infrastructure
You need access to two Google APIs: Prediction API & Cloud Storage: Cloud Storage is used to store the data, which are analyzed. There is no option to use another cloud storage provider.
Point your browser to the API Console at https://code.google.com/apis/console/ and create a “project”: the project is a container to cover all API, billing etc. needs for one application. The API Console Project also bundles all oAuth requirements for the Google APIs.
Under the menu item “Services” you can find the list off all available APIs for your project: make sure, that Prediction API and Google Cloud Storage are enabled. (Enabling of Google cloud storage requires you to enter billing information, however the free quota is 5GB (according to https://code.google.com/intl/de-DE/apis/storage/docs/pricingandterms.html )
For easier interaction with the cloud storage it makes sense to use Google’s GSUtil tool (http://code.google.com/intl/de-DE/apis/storage/docs/gsutil.html ): please put special attention to correct authentication setup, as detailed in http://code.google.com/intl/de-DE/apis/storage/docs/gsutil_install.html#authenticate .
The Storage manager web application is an alternative way to interact with the Cloud Storage: further details can be found at http://code.google.com/intl/de-DE/apis/storage/docs/gsmanager.html#using .
1) Methodology
In challenges like mentioned Kaggle challenge the methodology looks like the following:
- Check which information should be predicted (Regression with a function-like outcome y= f(x) vs. classification (choose from a list of discrete values)
- Classification/regression information is developed on a small training set. (normally based on a sample of 30% of the total rows)
- The created algorithms are tested on validity with a separat test dataset (normally based on the other 70% of the rows of the dataset.
- The prediction should match the value of the variable to be checked.
For this example I put the training & prediction part to Google prediction API in order to later test how good the prediction was.
2) Prepare your data set
Many data sources have some documentation attached, like in the Kaggle example:
| Variable Name | Description | Type |
| SeriousDlqin2yrs | Person experienced 90 days past due delinquency or worse | Y/N |
| RevolvingUtilizationOfUnsecuredLines | Total balance on credit cards and personal lines of credit except real estate and no installment debt like car loans divided by the sum of credit limits | percentage |
| age | Age of borrower in years | integer |
| NumberOfTime30-59DaysPastDueNotWorse | Number of times borrower has been 30-59 days past due but no worse in the last 2 years. | integer |
| DebtRatio | Monthly debt payments, alimony,living costs divided by monthy gross income | percentage |
| MonthlyIncome | Monthly income | real |
| NumberOfOpenCreditLinesAndLoans | Number of Open loans (installment like car loan or mortgage) and Lines of credit (e.g. credit cards) | integer |
| NumberOfTimes90DaysLate | Number of times borrower has been 90 days or more past due. | integer |
| NumberRealEstateLoansOrLines | Number of mortgage and real estate loans including home equity lines of credit | integer |
| NumberOfTime60-89DaysPastDueNotWorse | Number of times borrower has been 60-89 days past due but no worse in the last 2 years. | integer |
| NumberOfDependents | Number of dependents in family excluding themselves (spouse, children etc.) | integer |
| (original file at http://www.kaggle.com/c/GiveMeSomeCredit/Download/Data%20Dictionary.xls ) |
The documentation is the start point for the data scientist to see, on what basis he works: likely he will need further explanation & information from the business process owners to get the complete picture of both the task ahead and the information available right now: sometimes more information is needed.
The file cs-training.csv contains 150k rows of data in the structure also described above:
One important precondition to be met for working Prediction API is to have the value to be predicted in the first column: the first column is automatically seen as the only variable, which is to be predicted.
3) Upload your data
Google Cloud Storage can be seen as a large file storage, which organizes groups of related files in buckets: so we need first to create a bucket:
Daniel-Kollers-MacBook-Pro:~ daniel$ gsutil mb -l eu gs://kaggle-exercise Creating gs://kaggle-exercise/... Daniel-Kollers-MacBook-Pro:~ daniel$
In this example I named the bucket kaggle-exercise, the “-l eu” to gsutil that I want to have the bucket stored in a EU data center. “gs://” is the standard prefix used to create URL-like bucket names.
“gsutil ls” gives us all existing buckets:
Daniel-Kollers-MacBook-Pro:~ daniel$ gsutil ls gs://cs-training/ gs://kaggle-exercise/
Now let’s upload the CSV file to cloud storage (with “gsutil cp cs-training.csv gs://kaggle-exercise”):
Daniel-Kollers-MacBook-Pro:Downloads daniel$ gsutil cp cs-training.csv gs://kaggle-exercise Copying file://cs-training.csv... Uploading: 7.21 MB/7.21 MB
“gsutil ls gs://kaggle-exercise” gives us a kind of directory listing of the bucket:
Daniel-Kollers-MacBook-Pro:Downloads daniel$ gsutil ls gs://kaggle-exercise gs://kaggle-exercise/cs-training.csv
So we can see: the csv file is now uploaded.
3) Initiate the training process
The training process can be started on command line interface or a web interface: the web interface is handy for this task and can be seen at http://code.google.com/apis/explorer/#_s=prediction&_v=v1.4 .
As we are not going to use a public dataset we need to “switch to private access”: an authorization dialog checks the user account we want to use.
The main interface of the API explorer shows the available methods:
We select the insert call and need to provide further information in the request body:
The training ID is “credit-training” and th edataStorageLocation is “kaggle-exercise/cs-training.csv” (without the leading “gs://”).
The lower part of the window contains the call result after the click on the “Execute”-button.
Response
200 OK







