Thursday, February 22, 2007

Frequent Pattern Mining Implementations

The Apriori, DIC, Eclat and Fp-growth algorithms generate all frequent itemsets for a given minimal upport threshold. The Rules algorithm generates all association rules for a given minimal confidence threshold. They are all implemented in C++ (using the Standard Template Library). A survey of most of these methods can be found in my "Survey on Frequent Pattern Mining".



download CPP: detail





powered by performancing firefox

Use SQL to modify the FP-Tree tecniques in Tradiational Chinese

Using Unsafe Code in C#

Using Unsafe Code in C#

Compiling error:

Unsafe code may only appear if compiling with /unsafe



Solution:

In VS.NET, choose

Project - Project Property - Build - General - click "allow unsafe code"







powered by performancing firefox

Thursday, February 15, 2007

Calling an unmanaged DLL from .NET (C#)

Calling an unmanaged DLL from .NET (C sharp)

OK, so this first example is going to
show how to call an unmanaged dll from .NET (C#). There's no better way
to explain how it all fits together than by example, so first off we're
going to create an unmanaged dll in C++. The function we're exporting
from the dll would obviously be of vital importance to your business in
the real world and contain a wealth of logic, but for the sake of
simplicity let's have a void function that takes a basic struct as an
argument and does nothing more than alter the fields within it.


The header file in your project should contain the following definitions:

detail







powered by performancing firefox

Wednesday, February 14, 2007

A Tree collection - the code project - C# programming

A Tree collection - the code project - C# programming



I needed a tree collection for something or other a while back. I couldn't
find one at CP, so I decided to roll my own -- after all, how hard could it be?
2000 lines of code later... I hope you can gain from my experience, and at least
use this code as a starting point. I included everything I could think of,
including a verbose event set.






powered by performancing firefox

Sunday, February 11, 2007

Code under Free Daa Mining Course Code

Ref: http://www.kdkeys.net/forums/thread/2043.aspx

This is a release implemented with C# for the .NET Framework. It is an old release (2001 version).

DISCUSS THIS RELEASE

Please post all questions and discussions about this release here: http://www.kdkeys.net/forums/thread/1803.aspx





APRIORI ALGORITHM

--------------------------------------------------------------------------------

The APriori Data Mining Algorithm is used to create association rules from sets of items.

The algorithm finds patterns of items that are frequently associated together.



--------------------------------------------------------------------------------

Introduction :

A set of items is defined as an itemset and represents items found in a dataset. An example of a set of items is {Computers, Books, Videos, DVDs, Games}.

The datasets can be obtained from real world databases representing shopping carts, retail transactions, data warehouses, sales, orders and purchases database tables or created artificially.



This form of data mining is known as association rule data mining. Association rule data mining discovers associations among items in a dataset.

An example of association rule data mining is market based analysis. Market based analysis is a form of association rule data mining that finds associations between items that different customers purchased during their visits to a sales outlet.



The kind of associations discovered during market based analysis association rule data mining show a pattern of items that customers tend to buy together. E.g. During a market based analysis of a shopping basket one may discover an association between computer books and CDs showing perhaps that customers that buy computer books tend to buy CDs. This can lead to a strategic placement of CDs and computer books so that more CDs will be sold when computer books are purchased.

If customers tend to purchase computer books and CDs together then having a sale on books can lift and increase the sale of computers.





--------------------------------------------------------------------------------

APriori Algorithm :

The APriori algorithm is used to analyze a list of transactions for items that are frequently purchased together. Considering a transaction where the sale of software is increased by the sale of e-books, Support and Confidence are two measures used to describe market based analysis association rules created with an APriori algorithm.

E.g. a Support measure of 1% and a Confidence measure of 50% means that 1% of transactions analyzed contain purchases of e-books and software and 50% of customers who bought an e-book also bought a software.

A set of items is known as an itemset. An itemset which contains k items is known as a k-itemset. E.g. a set of items {Books, CD, DVD, Video} is a 4-itemset.

The number of transactiobns that contain an itemset is known as the Frequency or Support Count of the itemset. If the number of transactions containing an itemset satisfies the minimum support count specified then the itemset is known as a Frequent Itemset.

E.g. the 2-itemset {Books, DVD} has a support count of 5 in the database of transactions below.



The database below contains 9 transactions. Find the support count and confidence for the the 2-itemset {Books, DVD}.

Using the market based analysis apriori algorithm ceate an assocation data mining rule between {Books} and {DVD}.

Firstly the number of transactions that contain the 2-itemset {Books, DVD} is 5. The number of transactions containing the itemset {Books} is 6.

Consequently the support for the 2-itemset {Books, DVD} is (5/9) * (100%) = 55.6%

The confidence for the 2-itemset {Books, DVD} is = (Support Count({Books, DVD}) / Support Count({Books}) * (100%) .

Consequently the confidence for the 2-itemset {Books, DVD} is = ((5/6) * 100%) = 83.3%

Transaction 1: {Books, CD, DVD}

Transaction 2: {CD, Games}

Transaction 3: {CD, DVD}

Transaction 4: {Books, CD, Games}

Transaction 5: {Books, DVD}

Transaction 6: {CD, DVD}

Transaction 7: {Books, DVD}

Transaction 8: {Books, CD, DVD, Video}

Transaction 9: {Books, CD, DVD}





The APriori Algorithm basically finds the support count and confidence of itemsets eliminating those itemsets that do not meet a minimum support count and confidence measure from a final list of rules created.

Considering the list of transactions above, the algorithm will perform the following steps for a minimum support count of 3 :

The APriori algorithm creates a list of unique items in a 1-itemset Candidate Itemset corresponding to {Books, CD, DVD, Games, Video}

The support count of each item in the list above is obtained and any item that does not satisfy the minimum support count is eliminated from further analysis creating a 1-itemset Frequent Itemset

The 1-itemset frequent itemset is joined with itself to create a 2-itemset candidate itemset

The steps taken for the 1-itemset candidate itemset is repeated for the 2-itemset candidate itemset

The steps above are repeated until a frequent itemset is empty and no new candidate itemsets can be generated

A confidence measure is created for each rule generated from the frequent itemsets.





powered by performancing firefox

Friday, February 09, 2007

Yahoo! developer network

Yahoo! Search Web Services

It's may be used in the searching services.





powered by performancing firefox

ASP.NET AJAX Control Toolkit installation manuel

ASP.NET AJAX Control Toolkit installation manuel

ref:http://ajax.asp.net/ajaxtoolkit/Walkthrough/Setup.aspx





powered by performancing firefox

Sunday, February 04, 2007

GridView's Paging feature not working!

GridView's Paging feature not working!



Hi J,



When you manually bind DataSet to GridView, we'll need to manually handle

the paging work (register the PageIndexChanging event handler and bind the

new page data to Gridview...). In the aspx , we need to specify the

PageIndexChanging event handler as below:



ID="GridView1" runat="server" AllowPaging="True"

OnPageIndexChanging="GridView1_PageIndexChanging"

PageSize="5" />

The page's code behind is something like:



GetDataSource() function is just a test funciton I used to return a

certain DataSet that contains some data.....

======================================





public partial class GridViews_GridViewManualPaging : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

GridView1.DataSource = GetDataSource();

GridView1.DataMember = "items";

GridView1.DataBind();

}



}

protected void GridView1_PageIndexChanging(object sender,

GridViewPageEventArgs e)

{

Response.Write(" " + e.NewPageIndex);

GridView1.PageIndex = e.NewPageIndex;

GridView1.DataSource = GetDataSource();

GridView1.DataBind();

}



private DataSet GetDataSource()

{

DataSet ds = new DataSet();

DataTable dt = new DataTable("items");

dt.Columns.Add("id", typeof(long));

dt.Columns.Add("name", typeof(string));



for (int i = 0; i 50; i++)

{

DataRow dr = dt.NewRow();

dr[0] = i + 1;

dr[1] = "Item" + dr[0];

dt.Rows.Add(dr);

}



ds.Tables.Add(dt);



return ds;

}



}



=====================







Hope helps. Thanks,





Steven Cheng

Microsoft Online Support



Get Secure! www.microsoft.com/security



(This posting is provided "AS IS", with no warranties, and confers no

rights.)

--------------------



| Hello,

|

| I have a GridView in my ASP.NET 2.0 application that performs the paging

| feature perfect when I have it bound to a data source.

|

| But now I have it bound to a dataset and the paging feature will not work.

|

| When I try to use paging I get this error:

|

| The GridView 'gvResults' fired event PageIndexChanging which wasn't

handled.

|

| I realize that the PageIndexChanging event was not handled. How do I

handle

| this event if I am using a dataset as the data source of the gridview

| control?

|

| Additionally, I have to use the dataset as the data source because I do

alot

| of filtering and other stuff.

|

| Thanks,

|

| J

|

|





powered by performancing firefox

GridView examples for ASP.NET 2.0: Drilling down into detailed data

Detail here:



GridView Examples for ASP.NET 2.0: Drilling Down into Detailed Data

Click here to return to the TOC.

In the Filtering the Data Shown in a GridView
section we saw how to allow the user to display a list of products in a
DropDownList and, for the selected product, list the product's order
details in a GridView. That demo worked well for viewing order
details for a specific product, but imagine if you wanted to put more
of an emphasis on displaying product information, with viewing the
order details for the products being a secondary concern. In such a
situation you might want to show a GridView of the products with a way to "select" a particular GridView row. Doing so would then display the order details for the selected product in another GridView....





powered by performancing firefox

String or binary data would be truncated. The statement has been terminated

Error message got from SQL server,

soultion here:





Error message extacly return as follow:

System.Data.OleDb.OleDbException: The statement has been terminated.
String or binary data would be truncated.
at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)
at System.Data.OleDb.OleDbDataReader.NextResult()
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteScalar()
at userPostLinkFromWeb2.insertNewLink(Object sender, EventArgs e) in d:\BSMS\UserPostLinkFromWeb2.aspx.cs:line 122@



Probelm related:

probably u are trying to insert values in a column in a table greater than the max length of the column specified.

ie. u have specified max length for a column as 20 the string u are trying to insert is greater than 20



Action taken:

Resize the table columns from 50 to 255 and problems solved.





powered by performancing firefox

Saturday, February 03, 2007

SQL Server Full Text Search Optimization

SQL Server Full Text Search Optimization




Full text indexing is a great feature
that solves a long running database problem, the searching of textual data columns for specific words and
phrases in SQL Server databases.

However, as the full-text search engine is a
separate component of SQL Server (it uses the Microsoft Search Service) this
can be a potential performance problem due to the way full-text search interacts
with SQL Server.


Full-text search works really well when you are
searching a text column and you are interested in all the rows that match your
highly selective search criteria. However, full-text search is commonly used
with other SQL Server predicates, such as those included in the WHERE clause.







powered by performancing firefox

Understanding SQL Server Full-Text Indexing

Understanding SQL Server Full-Text Indexing in MSSQL Server 2000 and MSSQL Server 2005

Microsoft SQL Server supports T-SQL, an implementation of ANSI standard SQL. T-SQL is designed to (among other things) search for matches in your data. For example, if you've created a table with a column named Notes you could construct these queries:



SELECT * FROM MyTable WHERE Notes = 'Deliver Tuesday'

SELECT * FROM MyTable WHERE Notes LIKE '%caution%'

But what if you're not looking for an exact match, either to the full text of the column or a part of the column? That's when you need to go beyond the standard SQL predicates and use SQL Server's full-text search capabilities. With full-text searching, you can perform many other types of search:

  • Two words near each other
  • Any word derived from a particular root (for example run, ran, or running)
  • Multiple words with distinct weightings
  • A word or phrase close to the search word or phrase
detail...



powered by performancing firefox

The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it

When I first migrate the DataView form the original place to UpdatePanel, recompile it and error message returned:

"The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it"



Solution:

http://forums.asp.net/thread/1527394.aspx



You need to add the ScriptManager to your page. The ScriptManager control manages script resources for Microsoft ASP.NET AJAX pages



id="form1" runat="server" /> ID="ScriptManager1" runat="server" / />





powered by performancing firefox