100% Quality Private Proxies » TOP Anonymous + Buy Proxy Cheap Price!100% Quality Private Proxies » TOP Anonymous + Buy Proxy Cheap Price!100% Quality Private Proxies » TOP Anonymous + Buy Proxy Cheap Price!100% Quality Private Proxies » TOP Anonymous + Buy Proxy Cheap Price!
    0
  •   was successfully added to your cart.
  • Buy Proxies
  • Features
  • Info
  • Contacts
  • Blog
  • Account

For The Same Price! 2x MORE PROXIES $750 Private Proxies 5,000 2,500 Private Proxies 50 100 250 500 1,000 100 200 500 1,000 2,000 Private Proxies Private Proxies Private Proxies Private Proxies $30 $50 $100 $180 $340 BUY! BUY! BUY! BUY! BUY! BUY!

Query

I wish to have a SQL question to return the highest 5 frequent itemsets containing a given tag (string). In my instance under I used the Apriori algorithm however I might even be blissful to see any easier different approaches utilizing Postgres if that is onerous to implement.

Information

I’ve there following tables:

desk tag (
  id SERIAL PRIMARY KEY,
  label TEXT UNIQUE
);

desk article_tag (
article_id INT REFERENCES article(id) ON DELETE CASCADE ON UPDATE CASCADE,
tag_id INT REFERENCES tag(id) ON DELETE CASCADE ON UPDATE CASCADE ,
PRIMARY KEY (article_id, tag_id)
);

desk creator (
  id SERIAL PRIMARY KEY,
  title TEXT UNIQUE,
);
  • tags are programming languages or applied sciences
  • creator is the creator of an article
  • article_tag is a map of articles to tags

I’ve simply began to make use of Postgres SQL and wish to replicate what I’ve accomplished with this information utilizing Python.

Python code:

import pandas as pd
from mlxtend.preprocessing import TransactionEncoder
from mlxtend.frequent_patterns import apriori

tags = """1 python
    2   azure-devops
    3   lua"""

tagrows = [i.split() for i in tags.splitlines()]
df_tags = pd.DataFrame(tagrows,columns = ["id","label"])
df_tags["id"] = df_tags["id"].astype(int)
df_tags.set_index(df_tags.id,inplace=True)

article_map = """1  1
2   1
1   2
3   2"""

article_map = [i.split() for i in article_map.splitlines()]
df_article_map = pd.DataFrame(article_map,columns=["article_id","tag_id"])
df_article_map["tag_id"] = df_article_map["tag_id"].astype(int)
df_article_map["article_id"] = df_article_map["article_id"].astype(int)
df_article_map.set_index(df_article_map.tag_id,inplace=True)

merged = df_tags.merge(df_article_map,left_index=True, right_index=True)
merged_group = merged.groupby('article_id').label.apply(record).reset_index()
merged_group.set_index("article_id").sort_index()
tag_list_of_lists = merged_group.label.values.tolist()

te = TransactionEncoder()
te_ary = te.match(tag_list_of_lists).rework(tag_list_of_lists)
df = pd.DataFrame(te_ary, columns=te.columns_)
frequent_itemsets = apriori(df, min_support=0.02, use_colnames=True)
frequent_itemsets['length'] = frequent_itemsets['itemsets'].apply(lambda x: len(x))
frequent_itemsets

This permits me to search out frequent itemsets within the dataframe with size > 1. (I’ve solely added a minimal, reproducible instance right here so we do not get many frequent itemsets).

string_hit = 'python'

frequent_itemsets[(frequent_itemsets.itemsets.apply(lambda x : string_hit in x) & (frequent_itemsets.length > 1) & (frequent_itemsets.support > 0.03))]

Output:

output

Best Quality Private Proxies by Proxyti:

fully anonymous

100% anonymous and safe reliable private proxies

1,000 mb/s speed

Blazing fast proxy servers with up to 1,000 mb/s speed

Elite quality

Best quality proxies from world and USA locations

Unlimited bandwidth

No limits of using your proxies - truly unlimited bandwidth

Buy Now - Get 2X More Proxies:

100 Private Proxies

$30/month

$0.3 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

200 Private Proxies

$50/month

$0.25 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

500 Private Proxies

$100/month

$0.2 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

1,000 Private Proxies

$180/month

$0.18 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

2,000 Private Proxies

$340/month

$0.17 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

5,000 Private Proxies

$750/month

$0.15 Per Proxy
Private and Anonymous
Ultra Fast Speed
Unlimited Bandwidth
USA or Worldwide
2X More Proxies!
Buy now!

Our Unbeatable Proxy Features:

Anonymous Proxies

100% security with our proxies – anonymous and secure proxy experience

Ultra Fast Speed

Proxyti offers up to 1,000 mb/s ultra fast proxy speed – feel the real power!

Unlimited Bandwidth

No data limits for your proxies – truly unlimited proxy bandwidth for you!

Proxy Authentication

We secure proxies with IP authentication – use your proxies with your own IP

Elite Quality

Highest proxy quality guarantee with supported HTTP/HTTPS and SOCKS connections

Great Prices

Proxyti offers great proxies for great prices – this is what we call new proxy era!

USA Locations

You can choose USA or random proxies locations when ordering for free

No Limitations

We don’t have any limits – you can use your proxies with every software or program!

Lots Of Subnets

The more proxies you buy, the more subnets you get – it is worth ordering more!

Semi Dedicated

Our proxies are shared with maximum of 5 users at a time, but they are still anonymous

Fast Delivery

We deliver your ordered proxies in your email in .txt file – this is simple as that

Awesome Support

Have any questions or want more information – please contact us anytime!


About Proxyti

We deliver quality private proxy solutions for everyone – fast, anonymous, secure and unlimited proxies by Proxyti.
 

Secure Payments

All payments are made via Paypal – safe and secure payment system administrator

Top rated products

  • 200 Private Proxies
    Rated 4.83 out of 5
    $50.00 / month
  • 1000 Private Proxies
    Rated 4.82 out of 5
    $180.00 / month

Connect with us

Copyright Proxyti.com | All Rights Reserved
  • Buy Proxies
  • Features
  • Info
  • Contacts
  • Blog
  • Account
100% Quality Private Proxies » TOP Anonymous + Buy Proxy Cheap Price!
    0 items