What are the differences between Knowledge Graph Embeddings (KGE) and Graph Neural Network (GNN)

From page 3 of this paper Knowledge Graph Embeddings and Explainable AI, they mentioned as below: Note that knowledge graph embeddings are different from Graph Neural Networks (GNNs). KG embedding models are in general shallow and linear models and should be distinguished from GNNs [78], which are neural networks that take relational structures as inputs However, it's still vague to me. It seems that we can get embeddings from both of them. What are the difference? How should we choose …
Category: Data Science

A way to init sentence embedding for unsupervised text clustering, better than glove wordvec?

For unsupervised text clustering, the key thing is the init embedding for text. If we want to use deepcluster for text, the problem for text is how to get the init embedding from deep model. BERT can not get good init embedding. If we do not use deep model, is there better way to get embedding better than glove wordvec?
Category: Data Science

Multisite: use media from one site vs. copying the same media to all language sites?

This is a business site with product images. I have a multisite installation with 3 languages in 3 directories which will later be mapped to completely separate domains by the host when it's finished. The media (EDIT: in one of the sites) currently consists almost completely of large images (EDIT: total 1.8GB) that are not language-dependent, and editors will need to add the same images when creating pages with the texts in their language. However, their media library is currently …
Category: Web

Comments not appearing at all

I have comments enabled on my site but the form isn't appearing. It worked at one point as there are comments on some of my posts with links to them but they don't appear on the page. Take this post: https://arcath.net/2016/03/react/ The theme is clearly showing 1 comment at the top of the page. Comments are enabled in Settings -> Discussion I've read a lot of forum posts on the subject that lead me to these settings but I can't …
Category: Web

Coefficients values in filter in Convolutional Neural Networks

I'm starting to learn how convolutional neural networks work, and I have a question regarding the filters. Are these chosen manually or are they generated by the network in training? If it's the latter, are the coefficients in the filters chosen at random, and then as the network is trained they are "corrected"? Any help or insight you might be able to provide me in this matter is greatly appreciated!
Category: Data Science

How to sort custom post's category by id from the theme's function.php?

I'm wondering how to sort a custom post's categories in the selection field which I've circled in the screenshot? And I have the following code which generates category listing $args=array( 'class' => 'select-submit2', 'hide_empty' => false, 'selected' => $prop_category_selected, 'name' => 'prop_category', 'id' => 'prop_category_submit', 'orderby' => 'NAME', 'order' => 'ASC', 'show_option_none' => __('None','wpestate'), 'taxonomy' => 'property_category', 'hierarchical'=> true ); wp_dropdown_categories( $args ); ?>
Category: Web

Keras, DNN ending with sigmoid - model.predict produces values < 0.5. This indicates...?

I'm trying a simple Keras project with Dense layers for binary classification. About 300000 rows of data, labels are training_set['TARGET'].value_counts() 0 282686 1 24825 My model looks like this def build_model(): model = models.Sequential() model.add(layers.Dense(64, activation='relu', kernel_regularizer=regularizers.l2(0.001), input_shape=(train_data.shape[1],))) model.add(layers.Dropout(0.5)) model.add(layers.Dense(32, kernel_regularizer=regularizers.l2(0.001), activation='relu')) model.add(layers.Dropout(0.5)) model.add(layers.Dense(1, activation='sigmoid')) model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy']) return model So it's binary classification that ends with a sigmoid. It's my understanding that I should get values close to 0 or close to 1? I've tried different model architectures, hyperparameters, …
Topic: keras
Category: Data Science

Send specific users an email when posts are published

I've got the following code, which is supposed to run when a new post is published for the first time, check if a custom field 'specific_users' has data (this uses Advanced Custom Fields), and if so, send an email to each of the selected users. /** * Send users a notification of new grower posts */ function notify_growers($post) { // Only notify for grower posts if ( $post-&gt;post_type != 'grower_posts' ) return; $post_id = $post-&gt;ID; // ...run code once if …
Category: Web

Loading a Model with weights and optimizers without creating an instance in PyTorch

I recently downloaded Camembert Model to fine-tune it for my purpose. Upon unzipping the file the contents are: Upon loading the model.pt file using pytorch: import torch model = torch.load(model_saved_at) I saw that model was in OrderedDict format containing the following keys: args model optimizer_history extra_state last_optimizer_state As the name suggests most of them are OrderedKeys themselves with the exception of args which belongs to a class argsparse.Namespace. Using vars() we can see args only contains some hyperparameters and values …
Topic: bert pytorch nlp
Category: Data Science

Finite hypothesis with maximal VC dimension

The VCdim of a finite hypothesis class $H$ cannot be larger than $\log_2(H)$. But was is an example of a hypothesis class that has VCdim exactly equal to that quantity? For a reference, this is a question from the textbook Understanding Machine Learning by Shalev-Shwartz and Ben-David.
Topic: vc-theory
Category: Data Science

Classification using texts as features

I want to build a classification model to match customers and products. I have a description of each product, and a description of each customer, and the label : customer *i* buy/did not buy product *j*. Each sample/row is a pair (customer, product), so Feature 1 is customer's description, Feature 2 is product's description, and the target variable y is: &quot;y = 1 : customer buys product&quot;, &quot;y = 0 otherwise&quot;. The goal is to predict for new arriving products …
Category: Data Science

Wrap description and sub menu in a wrapper

I am trying to add a wrapper to description and sub-menu in wordpress using walker class, Description will only be shown for the first menu so the structure will look like this EDIT I have been able to add a wrapper div to description but not to sub-menu and menu description together so I am seeking assistance with adding a wrapper div to menu description and sub-menu(if any) &lt;ul id="menu-main-menu" class="primary-nav"&gt; &lt;li id="menu-item-41" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children first"&gt; &lt;a href="http://link" …
Category: Web

CRUD and Frontend show from a custom table without shortcode

I just wrote a plugin that creates a database, populates and edits rows from the backend, now what I need to show a list view of those rows with teir respective link to a detail viewo of each one. The shortcode approach I have already done it, but that does not get the purpose of my plugin, as I want it to be available in the Menus configuration, just like Woocommerce endpoints are. How can I do that? Has someone …
Category: Web

Custom forms + Polylang

I am new to Wordpress but I have some knowledge of PHP. I am creating a bilingual site (with Polylang) which has many forms. Some of them are handled by Contact Form 7 but some others have to be custom made. So, the first form I made was quite a disaster - it works but under certain circumstances. In the archives page of a custom post I insert &lt;form method="post" action="&lt;?php echo esc_url( home_url( '/' ) ); ?&gt;"&gt; &lt;input type="hidden" …
Category: Web

It is possible to pass $args that sent by add_settings_field() inside another function?

I'm trying To do my plugin Setting with OOP PHP when I'm Creating Setting Filed it sends $args so I can use it in their function, but when I call this function in another place it is for $args and it's undefined. here are my codes: Please Look At the Last Chapter and see the $args Add Setting: add_settings_field( 'st-test-color', __('Color', 'st-search'), 'st_color_ca', 'st-test', 'st-test-settings-section-2', array( 'name' =&gt; 'color_css', 'id' =&gt; 'st-test-color', 'class' =&gt; 'st-test-color', 'options' =&gt; $st_test, ) ); …
Category: Web

Finding optimal threshold in multi-class classification task

In a binary classification problem, it is easy to find the optimal threshold (F1) by setting different thresholds, evaluating them and picking the one with the highest F1. Similarly is there a proper way to find optimal thresholds for all the classes in a multi-class setting. This will be a grid search problem if we do it brute force way. Any efficient way to do this? Is there any package that ppl use or I can use for this? Also …
Category: Data Science

How to calculate true positive, true negative, false positive, negative and postive with Bayes Classifer from scratch

I am working on implementing a Naive Bayes Classification algorithm. I have a method def prob_continous_value which is supposed to return the probability density function for an attribute given a class attribute. The problem requires classifying the following datasets: Venue,color,Model,Category,Location,weight,Veriety,Material,Volume 1,6,4,4,4,1,1,1,6 2,5,4,4,4,2,6,1,1 1,6,2,1,4,1,4,2,4 1,6,2,1,4,1,2,1,2 2,6,5,5,5,2,2,1,2 1,5,4,4,4,1,6,2,2 1,3,3,3,3,1,6,2,2 1,5,2,1,1,1,2,1,2 1,4,4,4,1,1,5,3,6 1,4,4,4,4,1,6,4,6 2,5,4,4,4,2,4,4,1 2,4,3,3,3,2,1,1,1 Venue,color,Model,Category,Location,weight,Veriety,Material,Volume 2,6,4,4,4,2,2,1,1 1,2,4,4,4,1,6,2,6 1,5,4,4,4,1,2,1,6 2,4,4,4,4,2,6,1,4 1,4,4,4,4,1,2,2,2 2,4,3,3,3,2,1,1,1 1,5,2,1,4,1,6,2,6 1,2,3,3,3,1,2,1,6 2,6,4,4,4,2,3,1,1 1,4,4,4,4,1,2,1,6 1,5,4,4,4,1,2,1,4 1,4,5,5,5,1,6,2,4 2,5,4,4,4,2,3,1,1 The code for this is written like so: from numpy.core.defchararray import count, index import …
Category: Data Science

How to match the input image with the ground truth image (the order)

I'm a beginner learning deep learning and trying to do semantic segmentation problems on histologic image using python and TensorFlow. There is 2 main file : Images.npy and Labels.npy (Ground truth). So before the training, i want to match the input images with the ground truth images. So, the ground truth will be matched with the images. For Example : There is images_1 and labels_1. When we check labels_1 is match with images_1 (Matched). I want to avoid this condition …
Category: Data Science

VC Dimension of a Countably Infinite Class

I know that there are many examples of classes where the VC Dimension is finite/infinite even though the size of the class is Uncountably Infinite. However, I could not argue if the VC Dimension of a Countably Infinite class is always finite? (I feel that its size will be &quot;smaller&quot; than the size of a power set of an arbitrarily large set) Any help on this is appreciated.
Category: Data Science

Encoding features for multi-class classification

I have a question regarding how to setup a dataset for modeling. Let’s say I have a dataset representing which car a person will buy depending on some characteristics: The dependent variables are individual cars (Car 1, Car 2, … Car 100). The independent variables are: Budget (of the buyer) Favorite Color (of buyer) ….. ….. Color (of Car 1) Color (of Car 2) …. Color (of Car 100) MPG (of Car 1) MPG (of Car 2) ….. MPG (of …
Category: Data Science

wp_signon gives error insufficient_permissions

This seems odd to me because if you're signing on a user you shouldn't already be signed in... therefore your permissions shouldn't matter. It may be a bit of an odd way of going about it, so that could be causing the issue. Here's the code: function login( $user_name, $password ) { $creds = array(); $creds['user_login'] = $user_name; $creds['user_password'] = $password; $creds['remember'] = false; $user = wp_signon( $creds, true ); if( is_wp_error( $user ) ) { $result = $user; } …
Category: Web

Custom endpoint and X-WP-TotalPages (headers)

I have a custom endpoint defined like so: add_action( 'rest_api_init', function () { register_rest_route( 'menc/v1', '/crosscat/(?P&lt;dept&gt;[\w-]+)/(?P&lt;cat&gt;[\w-]+)', array( 'methods' =&gt; 'GET', 'callback' =&gt; 'dept_cat_api', 'args' =&gt; array( 'dept' =&gt; array( 'sanitize_callback' =&gt; function($param, $request, $key) { return sanitize_text_field( $param ); } ), 'cat' =&gt; array( 'sanitize_callback' =&gt; function($param, $request, $key) { return sanitize_text_field( $param ); } ), 'per_page' =&gt; array( 'default' =&gt; 10, 'sanitize_callback' =&gt; 'absint', ), 'page' =&gt; array( 'default' =&gt; 1, 'sanitize_callback' =&gt; 'absint', ), 'orderby' =&gt; array( 'default' …
Category: Web

Can i add custom code in Source in specific page, Header from function.php?

there are many plugins that do some job but can i add custom code per page? Also i mean specific code by pages,posts? with function.php? For example, that code will appear every page: function hook_link() { ?&gt; &lt;link href="http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico" rel="shortcut icon" type="image/x-icon"&gt; &lt;?php } add_action('wp_head', 'hook_link'); Can i make something like this with function.php for every page customed and specified?
Category: Web

How do i conduct t-test for comparing the accuracy of two binary classifiers?

I am using two binary classifiers that predicts the accuracy of samples over a dataset. Accuracy is defined as ratio of correct vs incorrect predictions. Do i need to take accuracies sampled over multiple experiments and use them as data for t-test. Can some explain please ? Also what will the result of the t-test convey?. Thanks in advance.
Category: Data Science

Time Series Continuous Classification

Intro I'm quite new to all the subjects in this question. This is my very first shot at Keras, Tensorflow, NNs or Time Series. If you're not a newbie, you'll notice that immediately. Problem I have 15 samples from an industrial process that reads temperatures, weights and heatflows every 2 seconds for roughly an hour (1876 rows). Samples look like this: temp weight heat t 0 31.9661 9.09606 -0.834733 2 31.9905 9.09503 -0.839906 4 32.0967 9.09374 -0.854042 6 32.3021 9.09315 …
Category: Data Science

add_rewrite_rule with trailing slash redirects

I have made my own routes by using add_rewrite_rule method. I would like to know if it is possible using given method to force all my created routes to redirect to URL where there is trailing slash in the end. For example if i do add_rewrite_rule('^my-route/', 'index.php?_my_route=1', 'top') or add_rewrite_rule('^my-route', 'index.php?_my_route=1', 'top') and i make a call to http://site.dev/my-route then it does not redirect it to http://site.dev/my-route/. If it is possible then i would be thankful for sharing :).
Category: Web

Hamburger Menu not working on reduced browser size

I'm currently working on my site but having a small issue with the hamburger menu. It works fine on an actual mobile device, but when I reduce the browser size so that the hamburger appears, nothing happens when I click on it. It does not show my menu. The only thing that happens is a '#' symbol appearing at the end of my URL when I click on it. Any idea on whats going on?
Category: Web

What kind of algorithm should I use to build ML model that can predict just next reoccurence of an event in the future (at irregular time interval)?

I'm quite new to machine learning and statistics. I've a dataset from some ecommerce sale's history. It's almost 2k instances, and features include personId (string), productCategory (string/discrete), amountPaid (float/continuous), purchaseTime (string/Time(DD/MM/YYYY)). Person can purchase product at any time (irregular time interval so I can't use time series analysis, I guess). I want to know when will the same person (attr with person Id) make just next purchase in a category (attr with productCategory). What ML model should I use for …
Category: Data Science

How to get Limoncello to look cloudy

I have been making Limoncello for about 3 years. It tastes really good, but I can't get the cloudy appearance the Commercial product has. Looking at recipes for &quot;Creme di Limoncello&quot; (which uses milk and cream), I am thinking of substituting some no fat milk for water in the simple syrup. Does anyone have an opinion about this, or tried it?
Category: Mac

How do I calculate the accuracy rate of predicting “Fail”? Am I supposed to create a confusion matrix?

Question: ABC Open University has a Teaching and Learning Analytics Unit (TLAU) which aims to provide information for data-driven and evidence-based decision making in both teaching and learning in the university. One of the current projects in TLAU is to analyse student data and give advice on how to improve students’ learning performance. The analytics team for this project has collected over 10,000 records of students who have completed a compulsory course ABC411 from 2014 to 2019.
Topic: data-mining
Category: Data Science

Users can login to Website from wp-admin prior to confirmation email

I have a wordpress website that has an account sign-up/login system. When a user creates an account from the website's signup page (not the wp-admin page), he has to confirm the email link (in his mail inbox) prior to being able to login. However, if the user goes to mywebsite.com/wp-admin, he is able to login and access website's resources as a logged in user without having to confirm his email. I suppose disabling access to wp-admin is not an option …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.