Rafazwonull vs Joe I/O


America is not at war.
30.07.2009, 17:34
Gespeichert unter: Netzkultur, Politik | Schlagworte: , , , ,

An dieser Stelle erlaube ich mir, das mir soeben zugetwitterte Foto meinen Lesern zugänglich zu machen. Anerkennend und dankend senke ich vor @ghensel, dem ihr bitte alle followen sollt, mein Haupt.

via http://twitter.com/ghensel

via http://twitter.com/ghensel

Wenn America in the mall ist, dann ist Germany auch nicht at war. Das deutsche ISAF-Kontigent ist vielleicht at war, während deutsche Politiker über Terminologie streiten. Vielleicht aber auch nicht, weil dann Terroristen als reguläre Kombattanten anerkannt würden.

-r-



Blogosphären Visualisierung
29.07.2009, 20:31
Gespeichert unter: Datamining, Visualisierung | Schlagworte: , , , ,

Beeindruckend. Matthew Hurst hat in seinem Blog einige Blogosphären Visualisierungen veröffentlicht. Mein persönlicher Favorit ist die folgende:

via http://datamining.typepad.com/

via http://datamining.typepad.com/

Dazu schreibt Matthew:

The dark edges show the reciprocal links (where A has cited B and B has cited A), the lighter edges indicate a-reciprocal links. The larger, denser area of the graph is that part of the blogosphere generally characterised by socio-political discussion (the periphery contains some topical groupings). Above and to the left is that area of the blogosphere concerned with technical discussion and gadgetry.

Mehr Visualisierungen gibt es in seinem Artikel Science July 24th 2009.

-r-



Was bringt es Twitter an StudiVz anzubinden?
8.07.2009, 13:39
Gespeichert unter: Netzkultur, Wirtschaft | Schlagworte: , , ,

Martin Weigert schreibt heute auf netzwertig, studiVz plane eine Öffnung der API für Twitter um Facebook endlich etwas entgegensetzen zu können. Die Feststellung studiVz sei gegenüber Facebook wirklich Anno-Dazumal ist nicht neu. Ich habe letztes Jahr in einem kurzen Beitrag über Offene APIs geschrieben, dass die Öffnung der Schnittstellen wesentlich zum Erfolg von Facebook beitrage und habe auch dort schon sinnvolle Initiativen von StudiVz vermisst.

Die Idee, studiVz mit dem Microblogging-Dienst aufzuwerten ist im Grundsatz sicherlich begrüßenswert. Auf den zweiten Blick ist es so weit von dem tatsächlichen Nutzungsverhalten der Zielgruppen entfernt, dass es weh tut: die Nutzer von studiVz werden durch den Bologna-Prozess zunehmend jünger, und die Alternative meinVz scheint am ehesten von Gelegenheitsnetzwerkern genutzt zu werden, für die gelegentliche Profilpflege, Bildupload im VZ und Pinnwandschreiben genug des Netzwerkens sind. Bei Twitter hingegen muss man wie beim Bloggen wirklich dranblieben.

Twitter ist überflutet von Digital Natives, deren Leben das Web ist. StudiVz ist ein nettes kleines abgegrenztes Netzwerk für zwischendurch. Ich wurde neulich übrigens von meiner Friseurin gefragt, ob ich auch bei studiVz sei. Ich habe verneint, gelogen und sie gefragt ob sie twittere. Ich versuche mich auch bei Twitter, allerdings ist mein Alltag bei aller Netzaffinität nicht annähernd so stark durch das Web durchsetzt, als dass ich wirklich dranbliebe. Echter Nutzen kommt dann vielleicht auch erst durch mobiles Tweeten auf, was eine Datenverbindung und ein nicht ganz unter Studenten-Mainstream-kompatibles Handy verlangt, was gegen andere Kostenfresser eines Studiums abgewogen werden muss. An dieser Stelle möchte ich wüste Bemerkungen über Studiengebühren vermeiden und übergehe dieses Thema.

Zudem fällt auf, dass die Suche und Installation eines Twitter-Clients schon etwas mehr Affinität verlangt, als das simple Anmelden-Netzwerken-Abmelden bei studiVz oder Facebook. Bei mir an der Uni liegt die Nutzung von Twitter bei Fernerliefen, und wenn sich doch jemand einen Account zulegt, dann meist doch eher aus Neugierde und dem Wunsch zur Ingroup zur gehören als aus der rationalen Überlegung, hier liege neues Networking-Potenzial… Wirkliche viele aktive Nutzer des Kalibers Stefan Martens scheint es zumindest nicht zu geben.

Ich glaube kaum, dass es hier möglich sein wird, die beiden Plattformen erfolgreich als Gegengewicht zu Facebook zusammenzuführen. Die Nutzerprofile und ihr Verhalten im Netz sind einfach zu unterschiedlich, wenngleich der Ansatz sicherlich sinnvoll ist. Erfolgreicher, da bin ich mir fast sicher, wäre die Einführung von Apps wie bei Facebook, die zwar kaum Networking-Nutzen bringen, allerdings asynchron funktionieren, Kurzweil bieten und die Leute im Netzwerk halten. Denkbar wäre auch eine funktionierende Youtube oder Flickr-Anbindung, und eine besser integrierte Chat-Funktion.

Mehrblog sieht das Ganze übrigens völlig anders. Hier wurden 500 Nutzer im Blog befragt, welche Applikationen sie sich im VZ wünschten. 39% votierten für Twitter. Ich bin mir sehr sicher, dass hier hinterfragt werden muss, ob die 500 Nutzer, die sich an der Umfrage beteiligt haben, nicht ohnehin schon sehr netzaffine Nutzer sind, denen Twitter näher liegt als dem Durchschnitt aller studiVZ-Nutzer.

Was meint ihr?

-r-

PS: Interessante Erkenntnisse über die Nutzungs der Netzwerke in Deutschland gibt es bei den W3B-Studien.



Quality Model Development
25.05.2009, 22:25
Gespeichert unter: Datamining, In eigener Sache, Information, Studium | Schlagworte: , , ,

Hi folks,

as suggested by Stefan Martens, I will provide you with some more ideas on how the model development works in data mining.

As I have written before, the basis for the model development is data which is an appropriate collection of both high quality blogs and – at best – low quality blogs.

Crawling high quality collections

The first one is easy. Where do you get a set of high quality blogs from? Technorati with its toplist of course is a good approach, but there are other ready-made collections of the best rated blogs. I chose the German Wikio-toplist, which is automatically created by an approach which is comparable to Technorati’s. I extracted the top 300 examples and fed them into the crawler. Among these supposedly high quality examples were blogs as the following ones. I will not post them as links: if my method can determine spam-blogs from non-spam blogs, the methods of highly paid Google-strategists can as well…

  • http://netzpolitik.org/
  • http://www.basicthinking.de/blog/
  • http://www.nerdcore.de/wp/
  • http://www.stefan-niggemeier.de/blog/

The blog crawler follows each of the URLs it is provided with and analyzes the blogs features. Just imagine scanning it for a set of defined characteristics. It takes into account, f.e. the length of the URL (1) , which has proved to be quite a good feature for the determination of quality in other web mining tasks. What is more, it looks for the existance of an RSS feed (2) and RSS-Comment-Feeds (4), as well as it counts the number of graphics (3), determines the blog update interval with the information from the RSS-Feed (5) and scans for the text length (7) or the length of the titles (6). These are just some examples of the 150 features the blog crawlers tries to exploit from the blogs HTML and XML structure.

Blogcrawler_Features

I have already shown you, what some of the data looks like it gathers from one blog, but this was only a part of the info which is really collected. In fact, the csv-output file you get from this collection has a size of about 1 MB.

Crawling …. well … „not so high quality“ collections

This was the easy part, but in order to create models for good blogs, you need a collection of bad blogs to seperate these from. In these terms it is like us humans: we determine what we are by knowing what we are not. The classification algorithms need info on what hiqh quality is not. Alas, there is not a collection of low quality blogs which is nearly big enough to have statistical profiles created, so I built a module, which collects a number of random pages from the web. They are random, which does not mean they have low quality, but some manual testing has confirmed the thesis that the predominant mass of the randomly collected ones have … well … less quality. The tiny number of quality blogs collected through the module does not really matter statistically. Anybody caring for a sample of not-so-good-blogs (i.e. not German top 300)?

  • http://lisungu.wordpress.com/
  • http://dasca.de/
  • http://viaperdita.wordpress.com/
  • http://armu.de/

Data Cleansing

The next step is the data cleansing. I wrote in in my other post „Status update for quality models“ how important it is to have clean data. Trust me: this is not fun! It is all a manual process, you will be staring at a lot of data in xls-tables for a long time… The result of this painful process is a 4MB csv-file with two collections in it: the blogs labelled good and the blogs labelled bad. You load this into your data mining problem and choose an algorithm which can handle nominal targets, which are the classes in context of which the classifier is to make sense out of the attribute data it is provided with (i.e. good / bad).

Classification with J48

This is where the real fun begins and you start creating your models. As an example, I chose J48 which is maybe the most intuitive algorithm. It creates a decision tree for the target classes using the attributes it is provided with. I trained it with 10-Fold-Cross validation, which is a validation method: the classifier takes 90% of the data and validated the model created through it with the 10% left. This is done ten times, and may take a while depending on what algorithm you are using and how many attributes and instances you are using it for.

The result for J48 is a decision tree and an accuracy, which tells you, what percentage of the initial classes the classifier got correctly using the attribute it was provided with. In case of a 90% correctness, this does just mean that the decision tree model from J48 attributed 90 out of 100 blogs to the correct class (ok, this is quite obvious isn’t it?). What the data mining tool is giving you is the tree and these numbers:

  • 98,55%  of „good“ recognized as „good“
  • 1,45%   of „good“ recognized as „bad“
  • 0,03% of „bad“ recognized as „good“

This is basically a confusion matrix. The decision tree, which was generated by the algorithm and which this accuracy is based upon looks like I have posted before:

This means using only the features relationLinksToSize, firstTableRowBGcolor and MeanFeedUpdateIntervall we get a correctness of 98%. We could actually reduce the number of the attributes accounted for to these three and get this accuracy, but only for the collections used. This is the offside of the model generated here: it is not easy to transfer it to other settings, you cannot tell that in general, these features are enough to tell quality blogs apart from other blogs. These results are just a hint on that these automatically seizable features are important to what we perceive as quality. What is more, these features seem to be not equally important for each language, which means that they are even more likely to be culture specific. This is why I collected some other sets of data in Russian and English to compare these results with, and as it seems the models created are far from being generally applicable. Each language-specific collection has its own discriminative features and the resulting models have greatly varying accuracies. While some of the differences can be explained by the differences within the data sets, some are due to differing blog profiles which result from the data. So what is needed are bigger crawls and representative collections to create more robust models and to be able to explain the differences of the resulting quality concepts in more detail.

-r-



Findings on Quality Blog recognition
24.05.2009, 13:20
Gespeichert unter: Datamining, In eigener Sache, Information, Studium | Schlagworte: , , , ,

Hi everyone,

I have almost finished formating my work and I guess I will go and print it in the next few days. I have learnt a lot of things about cleansing data and problems you stumble upon while data mining. Before really closing this chapter here and getting on to other projects I thought I might give you some ideas on my results.

In general it works quite well to determine the high quality blogs with the features used, even with rather simple algorithms. The decision tree in J48 for recognizing the controlled collection consists only of three nodes but gives you an accuracy of 98% for the German collection. The most interesting feature seems to be relationOutLinksToSize. This is confirmed by other collections and algorithms, and is quite an intuitively important feature. Just imagine link-spam blogs with a huge amount of outgoing links but no own content! What is more, with all collections the link-based features as the number of incomings links were really good discriminating features.

Interestingly, the accuracy (this means, how many blogs they recognize correctly) is not determined by the number of features you consider, but rather by how good they work together. With only 10 attributes taken together I get about the same accuracy for most algorithms, while some others improve substantially. This shows how important it is to have reliable data. The more useless features you give your algorithms to analyze, the more unreliable the resulting models will be. So it is much better to take a reduced number, which is easier to analyze and make your results with these ones…

J48 decision tree

J48 decision tree

So, what about the other collections? Here is the offside. The models seem to be at least partly language specific although I cannot really tell to what extent. All I can tell is that the Russian and the English collection created different models. While I achieved somewhat weaker results with the Russian one (67% with J48), the English collection was really a catastrophy: J48 got only 8% correct. I wondered why that was and tried to reduce the number of features considered, but only the Russian collection improved substantially through this (78% with J48). The English one stayed on that low level.

I guess the reason for the difference in accuracy is due to a certain lack of homogenity of the data. While I got rather homogenous collections in Russian and German, there are a lot of people blogging in English (as me right now). Necessarily the amount of different types of blogs raises in this language, and the overall number of blogs available increases. What is more, the average quality does not increase, so I get a random collection which is really heterogenous and the classifier does not know how to determine a profile of high qulity blogs. However, this idea needs to be proven by other results.

So, what do you think? Anybody caring for the results of the language recognition (russian blogs work best!)?

-r-



Data Cleansing and Quality Model Generation
24.04.2009, 9:06
Gespeichert unter: Datamining, In eigener Sache, Information | Schlagworte: , , ,

Hello World,
after a long time of idleness I thought I might give you an update on my work.

I have crawled quite of lot of pages until now and I have built up some interesting collections of controlled and random pages in English and German. The russian collection is currently being generated due to Max’ help and I am looking forward to finding out its features. Alas, nobody seems to know any Persian or Persian-speaking people (Can anybody help out?).

I have run some tests and I got some interesting results. First of all, it seems to be really really important to have very(!) clean data. At the beginning I only imported the data into Excel, cleansed it and exported it again. The classifiers had accuracies up to 80% after Ten-Fold-Cross validation which was somewhat disappointing. I tried to cleanse the data once again by removing the „0″-entries where the crawler failed to determine values, but the accuracy dropped even further to about 30%. I manually checked up on the accuracy of the crawler and it seems to be a rather rare case that the crawler cannot analyze some features, and I have a 95% propability to get any value correct. If I remove the 0-values, of which 95% were correct, the classifier just lacks information. Finally I found out another reason for error: Excel converts decimals to dates (01.05. to 01. May 2009) and you really need to be careful about this. I changed the settings to avoid this, and even with Naive Bayes I get accuracies of over 90% after 10-Fold-Cross. This is kind of an success. However, this accuracy is a combination of the classifiers ability of recognizing quality-blogs and mediocre blogs, and in general it is much easier to determine the latter ones. The distribution of the correctly classified instances gives you a better estimate of the classifiers reliability:

accuracy_after_10f-c1

As expected, the link-based features work best by the way. Google-Indegree is really a good measure, but Comment-based analysis seems to get you reliable results as well. I found some other graphic features which get you about 20% information-gain, but I do not know how to interpret this yet.

In another test-setting I tried to tell apart English from German blogs with the features I logged. As it seems I get about 50% correct (which is close to „It does not work!“), even with clean data.

Looking forward to reporting more…
-r-



Crawling Russian and Persian Collections
8.03.2009, 21:03
Gespeichert unter: Datamining, Information, Kultur, Studium | Schlagworte: , , , ,

I just used the crawler on a random collection of Persian and Russian blogs. I expect interesting outcomes from applying data mining methods on the attributes coming from culture specific blog collections, so trying if the parsers work for these types was an important step. Of course I have already used it on blogs from the U.S., but the differences really were not at all grave. I fear there are no structural difference between English and German blogs, so the next idea would be to apply it to some more distant language area.

I downloaded a stopword list in Russian and integrated it in the search. Looking at the results at first I thought I had an character encoding issue. While a German blog has about 300 stopwords per page, a russian one has between 15 to 30, while the overall number of words does not decrease. I asked a Russian friend of mine, what the matter with my list could be and he had a look at the page and stopwords in question. Obviously the algorithm, the list and the pages were all normal, and he supposed that the difference was due to a factual difference in the structure of spoken language. While the number of Russian stopwords was actually at least the same as in German, articles were in fact rarely used on the web pages. If you consider the structure of German or English which are languages that demand articles all the time, I may have bumped into a structural feature which might really help me tell German blogs apart from Russian ones.

Another issue I am facing now is the lack of a controlled collection in Farsi. My friend Max has already helped me finding the Top 100 or so blog in Russian, but Farsi seems to be a much harder nut to crack. Does anybody know a Persian or even better both Persian language and a collection of Top300 Persian blogs? Help is highly appreciated…

-r-



Modelling topical coherence of Blogs: News on my project
6.03.2009, 2:03
Gespeichert unter: Datamining, In eigener Sache, Information, Studium | Schlagworte: , , , ,

Again, I was pointed at something by a friend which I had not thought of before. Of course it had occurred to me that the issue I am covering with my thesis might be interested to the English-speaking world, but up until now I was quite unsure whether to change the way I write (and publicly and unchangebly leave my English traces in the never-forgetting web). However, the decision is taken and this will be my first English post.

Aquaint Blog crawler project

As I introduced before, I am currently writing my master thesis on an issue which may be drafted „Quality Models and Data Mining in Blogs“. I explained to the German speaking readers, that I was going to implement a webcrawler based on an implementation from the Hildesheim University AQUAINT project. The bot is to crawl through a controlled collection of Weblogs and record attributes (currently 150) which could be of interest for the statistical creation of binary, quality based model. Using the popular WEKA-toolset, I am confident that it will be possible to find signigicant patterns in the entity of the quality-labeled blogs. These patterns will help us discriminating from a random collection of much bigger size, equally „good“ (i.e. reliable, of high quality, high reputation, A-Listers) blogs from blogs which do not reach up to the standard of the controlled collection. However, this is not the only goal of collecting those features: we might find different structures in e.g. German and English blogs, or which is even more probable European and Asian blogs. The range of possibilites is huge once the crawler is running in a stable version and I am sure the features I am recording really express what I think they do.

The current implementation

Currently, the crawler is runs on a server and collects a number of random German blogs. I have run some trials with WEKA and it seems my idea is not all that dumb as I am able to successfully tell apart high-quality blogs from a random collection using the learned model using different algorithms (the weakest of which is Naive Bayes with an accuracy of 50%, the strongest being (currently) J48 with about 92%).

… and my current challenge: Coherence Analyis

What I am currently working at is a notion of cohesiveness of a blog, which I would like to explain in this post. What do I mean by „cohesiveness“? I would like to introduce this as a measure determining the topic variation of a certain blog. There may be blogs which cover e.g. the issues „dogs“ and „cats“, which occupy themselves with pets. On the other hand there may be bloggers writing on „cats“, „cars“, „computers“. As you can see, the range of different topics is bigger in the latter example. This means the blogger is less focussed on a specific range of topics.

How can we measure this cohesiveness and see how many topics the blogger is writing about? I consider the usage of tags and categories an important clue, as most bloggers use them to organize their post semantically. And what is more important, tags are even linked to a page which collects and displays all the posts marked with the specific tag. This page may be considered the blogger’s concept of the tag he uses. This is an important notion, as one blog might use the tag „cats“ to write on animals, while another one might use it as an acronym for „Computer Assisted Trading System„. So we can assume, the absolute meaning of the terms and their distane does not determine as good the actual topical difference of the blog as the blog-specific term-usage.

Cats != Cats.

If (Cats!=Cats)...

Now we can assume, that each of our tag-pages (or respectively categories page) which links to a same host page is representing one of the issues the blog is dealing with. How can we determine the similarity of the issues? One way, and this is the most obvious one, I guess, is to determine the similarity of each tag page as a basis to calculate the overall cohesiveness. This approach is not all new and it has been successfully used by a group of dutch scientist some time ago. I modified it to fit my needs and I would like to introduce some of the results here, including their shortcomings.

Jiyin He Coherence

There are a couple of possible approaches. The one I currently consider most applicable and quite sophisticated uses a package called simmetrics which allows the application of various string comparison algorithms, including some vector space models as cosine similarity and euclidean distance. It offers some other, more basic functionalities as qgram or dice, but I was primarily focussing on the vector space models.

Simmetrics Performance (by http://www.dcs.shef.ac.uk/~sam)

Simmetrics Performance (by http://www.dcs.shef.ac.uk/~sam)

One of my latest approaches is to use the cohesiveness notion introduced by the above mentioned group to calculate the similarity of all the links to the tag pages. The coherence ranges from 0 (meaning none) to 1 (meaning same documents). In my crawler, it is called „JiyinHeCoherencePerUrls“ after the person who introduced it (to me!). The pseudo-code is as follows:

For a given Blog, get  all the Tag-Pages.
Take the first Tag-Page and get all the text on the page;

For each of the Tag-Pages,
{
take the next Tag-Page and get all the text on the page;
Compare the two texts using the simmetrics package and save the result;
Cummulate the results of the comparisons;
Count how many comparisons we have done;
Set first Tag-Page to next Tag-Page.
}
Set the Coherence to the cumulated similarities per number of thecomparisons.

However, this way of measurement has some offsides which I can only partly compensate:

  • The simmetrics calculation using Vector space models is not stable. It sometimes just hangs up. I don’t know why. However, I am not sure if  using character-based models is an appropriate alternative.
  • As you see, I copy the text of the second page once. This is to avoid double server access to download the same page. We are opening up 10 pages per second if we do not reduce server strain, so this is why I set a delay to each page access which is between 4 seconds (trial) and 12 seconds (real crawling situation).
  • This method eats up a lot of resources. I reduced the size of the strings to compare using just the link labels of a page, which is an approach which had been favoured by a lot of search engines in former times (maybe up till now). This is due to the fact that usually the content of pages can be quite well determined if you take into account the links they use. However, I still have the problem with the Vector space calculation hang-up with some pages…

Simple Term-based coherence

Another notion of coherence I have been experimenting with is a more simple, but also more stable one. I have refrained from calculating the similarity, I have just defined the coherence from to pages as the number of same words on two pages per number of all words on the pages. Of course we only consider unique terms, ignore double occurences, space, punctuation etc. This leads to a really simple model, the pseudo code of which is following:

For a given Blog,
get  all the Tag-Pages.

Take the first Tag-Page and get all the text on the page;
Tokenize the content to words.

For each of the Tag-Pages,
{
take the next Tag-Page and get all the text on the page;
Tokenize the content to words.


For each of the words of  the first Tag page
For each of the words of the next Tag page
If word#1 equals word#2
increment nr of same words per url;

Division: Divide the nr of same words pre url per words first Tag page + words on next Tag page;
Set first Tag page text to next Tag page text
}

Calculate Standard Deviation, Mean and Median for all the Divisions done throughout the page comparisons.

This approach is much faster and more stable, however one can doubt (as Max usually does), the validity of the calculated feature.

After all, I am not sure which algorithm to use in the end. Actually I prefer the first one, but as the Vector based similarity approach is not working, I doubt whether the second one is worse than qGram analyis. After all we must not forget, that the feature I am discussing here will not be used as an isolated instance but is an attribute next to about 149 which are less complicated I feel. While you can surely argue the validity of the coherence measure, there is less uncertainty on attributes as the number of H1 tags or outlinks. But I need to say, this one has been most interesting so far.

Anyway, hints on how to use  to Vector based simmetrics here and why they hang up are highly appreciated, and so are ideas on which measure is the more appropriate one. I will happily provide the source code of the classes upon request. Usually I would publish it right away, but you see, I am still to be evaluated so I will better avoid bumbing into allegations I had commited plagiarism from an Internet source… ;) So, if you like it, there is more to come.

Good Night.

-r-



Crawling und große Dokumente: Marcels Herausforderung
24.02.2009, 2:12
Gespeichert unter: Datamining, In eigener Sache, Studium | Schlagworte: , , ,

Marcel hat gerade  die 5000-Comments-Challenge des Smashing-Magazine als Herausforderung für den Crawler zugetwittert, die ich gerne annehme.

Die ersten drei Mal habe ich einen Timeout bekommen, was mir im Augeblick aber auch im Browser passiert und bei einer 1,6 MB großen HTML (denke ich) für das erste ok ist. Das vierte Mal lief der Crawler erfolgreich durch, wenn auch nicht schnell. Damit ergeben sich einige interessante mitgeloggte Features, von denen ich hier einen Teil aufführe. Ich widme sie: Marcel.

nrOutLinks: 2629
nrOutLinksSameHost: 258
fileSize: 1572606
nrDOMElems: 20672
nrTagMeta: 8
nrTagTable: 2
nrTagTd: 6
nrTagTr: 3
nrTagH1: 2
nrTagH2: 1
nrTagP: 0
nrTagB: 0
nrTagScript: 38
nrTagLayer: 0
nrTagStyle: 0
nrTagHr: 0
nrTextLayoutTags: 2298
nrTagCursBold: 17
nrTagFont: 0
linkLabelLengthDev: 13.0
linkLabelLengthMedian: 13.0
linkLabelLengthAve: 13191616766467000
nrTagFrameset: 0
nrTagForm: 2
nrSentenceMarkers: 6171
nrTableInTables: 0
blanksInText: 54122
lengthTitle: 73
lengthPureText: 304992
uniqueWordsPureText: 3895
nrWordsPureText: 16835
nrStopwordsPureText: 5623
nrImgLinks: 2322
relationLinksToLinksToSameHost: 0.09813617
nrhtmlLinkstoFeeds: 7
nrAlternateLinkstoFeeds: 1

Wer will, kann gerne nachzählen.

-r-



Last und Lust des Crawling
22.02.2009, 16:34
Gespeichert unter: Datamining, In eigener Sache, Studium | Schlagworte: , , ,

Nachdem ich ja kürzlich schon grob auf die Kernidee meiner Arbeit eingegangen bin, will ich jetzt die Gelegenheit nutzen, über meine Erfahrungen mit dem Crawler ein wenig mehr zu berichten.

Mein Bot basiert auf dem OpenSource-Projekt JoBo1.4. Auf der Seite wird ein wenig tiefer gestapelt als notwenig, denn es heißt, JoBo verfolge Links und lade die Seiten herunter, im Prinzip es ist aber ein tolle Grundlage für einen Crawler. Mit dem Aufrufen der Seiten ist aber noch nicht getan, denn ich könnte im besten Fall einen Batzen Quellcode auslesen, ohne aber auf die Struktur des Dokuments schließen zu können, in der ganz wesentliche Informationen über die Seite stecken. In AQUAINT wurde schon implementiert, dass die aufgerufenen HTML-Seiten mit JTidy geparst und in DOM überführt werden, so dass ich die Markup-Informationen effektiv nutzen kann.

In diesem Rahmen sind nun die anderen Pakete und Klassen angeordnet, die unterschiedliche Fähigkeiten haben, und unterschiedliche Teile eines Blogs analysieren:

HTMLAnalyzer

Aus AQUAINT stammt der HTML-Analyzer, der gut 100 Markups analysiert und mitloggt. Wenn sich herausstellt, dass die Seite, auf die der Crawler trifft eine Blog sein sollte, wird diese Klasse aufgerufen, um entsprechende Features mitzuloggen. Wie ich schon im letzten Beitrag geschrieben habe, passiert die Überprüfung, ob ein Blog vorliegt, ganz simpel mit der Analyse, ob im Header des Blogs die Information über einen verfügbaren ALTERNATE Feed vorliegt. Mir ist bewusst, dass das kaum ausreicht, um definitiv zu sagen, ob ein Blog vorliegt, denn auch Seiten, die keine Blogs, sondern ganz einfach redaktionell erstellte Nachrichten sind, verfügen inzwischen über Aggregationen. Dennoch will ich den Raum für alle Arten von möglichen Blogs übrig lassen, denn es gibt auch ausgezeichnete redaktionell erstellte Blogs, die zwar geprüft sind, und eher dem Konzept einer Zeitung näher kommen, aber immernoch der Kategorie Blog zuzuzählen sind. Der Übergang ist leider fließend, und ohne einen Katalog, die Reduzierung auf einige blogtypische Hosts wie WordPress oder Blogspot, oder eine qualitative Analyse, ist wirklich schwer zu sagen, ob ein Blog vorliegt oder Online-Nachrichten. Das ist leider eine Ungenauigkeit, die ich wohl akzeptieren muss.

Wrapper

Zusätzlich ist ein Wrapper implementiert, d.h. eine Klasse, die eine Reihe von Suchmaschinen aufruft, um Rang, Inlinks der Seite usw. zu prüfen. Beliebt ist diese Methode nicht gerade bei Suchmaschinenanbietern, weil sie eine Menge Last erzeugt. Um meine IP nicht bei der dritten Seite bannen lassen zu müssen, habe ich eine Verzögerung im Wrapper eingebaut, die soweit angepasst werden kann, dass der Wrapper in seinem Seitenaufrufverhalten kaum von einem echten Nutzer zu unterscheiden sein sollte. Er funktioniert bei den meisten Seiten recht problemlos.

Bloganalyzer

Eine Kernklasse des Blog-Bots ist der BlogAnalyzer. Er analysiert all die Kriterien eines Blogs, die HTMLs üblicherweise nicht haben, und die der HTML-Analyzer dementsprechend auch nicht analysiert. Dazu gehören z.B. die Anzahl der Kommentare auf einer Seite, die Anzahl der Tags und Kategorien, usw. Problematisch ist hier vor allem, dass Standards fehlen und mein BlogAnalyzer natürlich oft nicht weiß, wonach er suchen soll. Ich hatte anfangs die Idee, die Blogroll zu analysieren, soweit vorhanden. Auch, wenn es einige wirklich gute Initiativen gibt, z.B. XOXO als Standard durchzusetzen, halten sich nicht alle Blogger und Bloganbieter daran, so dass es hier kein standardisiertes Markup gibt. Blogrollanalyse böte zwar interessante weitere Möglichkeite, z.B. zu prüfen welche Authority die verlinkten Sites besitzen, scheitert vorerst aber ganz trivial am Fehlen der Standards.

FeedAnalyzer

Eine weitere wesentliche Klasse, und eine, auf die ich besonders stolz bin, ist mein FeedAnalyzer. Der FeedAnalyzer z.B. liefert mir Informationen über die Anzahl der Beiträge, die durchschnittlichen Intervalle zwischen den Veröffentlichungen einzelner Posts und über die Länge ihrer Titel. Besonders interessant werden die Möglichkeiten bei Kommentarfeeds, über die  z.B. die Anzahl der Kommentierenden ermittelt werden kann. Ich analysiere nur RSS2.0-Feeds, weil die vermeintlich am weitesten verbreitet sind. Atom ist zwar das neuere und stärker detaillierte Format, allerdings wird es nicht von allen Blogs angeboten, und so ist RSS2.0 meist der kleinste gemeinsame Nenner. Bei allen modellierten Features ist es wichtig, dass sie beim Großteil aller Blogs mehr oder weniger gut funktionieren, denn wenn eine hochspezialisierte Methode bei 3/4 der Kollektion Exceptions wirft und abstürzt, habe ich keine aussagekräftigen Zahlen. RSS bietet schon eine ganze Menge, ist schon schön in XML aufbereitet und kann gut von einem weiteren auf SAX basierenden Parser analysiert werden. Ich hatte an dieser Stelle auch versucht mit ROME zu arbeiten, das eine Weiterentwicklung für alle möglichen Aggregationsformate darstellt, bin aber leider gescheitert: irgendwie hat ROME nicht die Funktionen bereitgestellt, die ich brauchte, und so kam es zu kaum ordentlichen Ergebnissen. Zwar wurde die Seite schön geparst, ich konnte aber nicht auf einzelne Elemente von Feeds zugreifen. So nutze ich ROME derzeit nur, um zu prüfen, welche Art von Feed vorliegt, bevor ich den FeedAnalyzer losschicke, was eigentlich Verschwendung ist… Wenn sich jemand gut mit ROME auskennen sollte, sind Tips hoch geschätzt!

Die Sache mit der Zeit…

Der Crawler ruft, wenn man ihm eine Kollektion von Seiten gibt, nicht nur durch den Wrapper, sondern vor allem durch den BlogAnalyzer eine ganze Menge zusätzlicher Seiten auf, d.h. für jede Seite, die ich ihm zur Analyse vorgebe greift er gut 25 Mal auf per HTTP-GET auf irgendeinen Server zu. Demenstprechend produziert er ein wenig Last. Ich habe die Belastung anderer Server zwar durch die Drosselung verringert, allerdings grenzt das aufrufen von 25 Seiten innerhalb von 1,5 Minuten schon an geschäftliche Nutzung, so dass es nur eine Frage der Zeit ist, bis mein Provider mir zornige Emails schreibt. Der Crawler läuft also seit geraumer Zeit nur noch auf dem Server der Uni. Das hat weitere Vorteile, denn der Server ist natürlich auch um einiges fixer als mein Rechner bei der Berechnung einiger Features. Trotzdem ist es vielleicht von Interesse, wenn ich einige Zahlen nenne, damit ihr die Dauer einer Crawlsession einschätzen könnt:

Für die Analyse einer Seite braucht der Crawler gut 1,5 Minuten, ruft dabei 25 weitere Seiten auf und pausiert einige Sekunden zwischen ihnen. Meine kleine kontrollierte Kollektion von Blogs ist 300 Seiten dick, meine unkontrollierte derzeit 2400. Für die Analyse meiner kontrollierten Kollektion braucht mein Crawler vom Server aus etwa einen Tag, bei der großen hat es letztens 4-5 gedauert. Diese Dauer wird noch um einiges vervielfacht, wenn ich einige meiner Testanalysen zuschalte, die sich noch akut im Beta-Stadium befinden, und so noch nicht zur Analyse großer Kollektionen herangezogen werden.

Wie eine LogFile des Servers aussehen kann, seht ihr unten. Die Analyse ist nicht ganz sauber gelungen, was in diesem Fall an unsauberem XML im Feed lag.

http://bulgariana.blogspot.com/ 19 Feb 2009 16:31:27 GMT
text/html; charset=UTF-8

***Alternate feed found. Should be a Blog here!
***Starting to log HTML features!

***Starting Stopword Analysis

***Starting Wrapper with 11 sec SleepTime
***Finishing Wrapper

***Starting BlogAnalyzer
***Finishing BlogAnalyzer

***Trying to find Alternate Feeds
***Alternate Feed found: http://bulgariana.blogspot.com/feeds/posts/default
***Feed Type: rss_2.0
***Alternate Feed found: http://bulgariana.blogspot.com/feeds/posts/default?alt=rss
***Feed Type: rss_2.0
***More than single alternate RSS2.0 feed found: 2
***Applying heuristics.
***Got single alternate feed: http://bulgariana.blogspot.com/feeds/posts/default

***Starting to log RSS features
19.02.2009 17:32:49 hellmann.quality.AnalyzedURL setFeature
SCHWERWIEGEND: Fehler bei SetFeature: null
***Feed successfully analyzed.
***Processing HTMLLinks heuristically to find Comments Feed
*Error parsing CommentsFeed: Invalid XML: Error on line 42: The entity name must immediately follow the ‘&’ in the entity reference.
*Error parsing CommentsFeed: Invalid document
***RSS Comments Feed Determination failed

-r-