DeepSets Keras Architecture

I am interested in the Deepsets Model but I am not quite sure how to implement it in Keras/Tensorflow for a normal regression task. More specifically the DeepSet model should take an arbitrary-sized set and perform a regression task. My question is the following: In the Deepest model, the encoder part should be shared across the elements in the set and it should work for an arbitrary number of elements (different sized). How to enable this in Keras? How to …
Category: Data Science

Reward function to avoid illegal actions, minimize legal action and learn to win - Reinforcement Learning

I'm currently implementing PPO for a game with the following characteristics: Observation space: 9x9x(>150) Action space: 144 In a given state, only a handful of actions (~1-10) are legal The state in time-step t can vary a lot from state t+1 The environment is episodic (~25 steps, depending on level) and ends with a win or a loose In some levels, a random policy (if only legal actions are made) can result in a win, in some levels strategy is …
Category: Data Science

Output product category link from WP_Query

I have a WP_Query that outputs products from given Product category name. For each product list I would also like to link to the category of that product, but I'm not sure how. My query: <?php $new_posts = new WP_Query([ 'product_cat' => 'printer', 'post_type' => 'product', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'meta_key' => 'view_count', 'posts_per_page' => 9, ]); ?> Output link something like this: <a href="<?php echo $cat_id ?>" class="procat-link">More Products...</a>
Category: Web

web.config conflict on IIS

folder structure docroot |- wordpress |- web.config |- wp-content |- japi |- index.php \- web.config ... ... As you can see there are 2 web.config s. One in the wordpress folder and one in wordpress/wp-content/japi folder. japi/web.config <rules> <rule name="Imported Rule 1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /> </rule> </rules> Now when I request for http://domain.com/wordpress/wp-content/japi/test. The japi/web.config seems to be neglected …
Category: Web

Accessing Flask WS APIs over intranet -

I have 2 scripts - A.py and B.py, and both are Flask apps. A.py renders a web page and acts as my UI taking inputs from user. B.py is hold the main logic and has a web service API being called by A.py. Both run as flask app services in localhost from different ports - 5001 and 5002, respectively. My doubts - 1) Every time I make any changes to my B.py (or A.py), do i need to stop and …
Category: Data Science

LSTM Multiple Independent Input Time Series - Data Preprocessing

Given a single univariate time series of complexity say 5, look-back of 2 and forecast of 1 the generated samples would be: TS = [ 1 , 2 , 3 , 4 , 5 ] xTrain = [ [1,2] , [2,3] , [3,4] ] that gets reshaped to dimensions [ 3 , 2 , 1 ] yTrain = [ 3 , 4 , 5 ] My question is what if 2 or more univariate time series were provided, how should …
Category: Data Science

Working with a json feed & trying to figure out how best to import

Good morning all, I need to be able to import a json product feed on a daily basis to update our products and stock. I am starting to write a plugin to make this work, but have a couple of questions if somebody could please advise? (I'm relatively new to Wordpress) Here is a sample of the json I need to import: { "Type": "Air Pistol", "Mechanism": "CO2", "Calibre": "4.5mm BB", "Make": "ASG", "Model": "SCHOFIELD", "Variant": "GREY", "Origin": null, "Orientation": …
Category: Web

Learning the Average of a 0/1 Dependent Variable

uppose I have a matrix and a dependent vector whose entries are each in {0,1} dependent on the corresponding row of Given this dataset, I'd like to learn a model, so that given some other dataset ′, I could predict average(′) of the dependent-variable vector ′. Note that I'm only interested in the response on the aggregate level of the entire dataset. One way of doing so would be to train a calibrated binary classifier →, apply it to ′, …
Category: Data Science

How can I create a "trained" dataset for categorizing news articles?

I am trying to automatically categorize news articles according to their primary topics, i.e. politics, entertainment, sports, business, technology, health, etc. There are some labeled datasets out there, but ideally I would like to create my own (for potential commercial usage later on). I am using python, but an answer clear enough with relation to any language would be sufficient. So, what would be the best way to go about this task? My current thoughts are: Determine the most popular …
Category: Data Science

How to create input page in Wordpress admin panel?

I have never used wordpress before and I'm trying to learn it now, I hope in this forum we can discuss about wordpress more, so I can more understand about it. I have problem, that I want to create a input page for category but this form are located in admin panel. So, how to do it? especially about that steps. Thank so much..
Category: Web

Move main menu to top of screen

I'm using the Twenty Seventeen theme and my goal is to move the main menu (top nav) from its position under the header image to the very top of the page directly over the header image (transparent background), but there seems to be a lot of javascript in addition to css involved in positioning the menu and making it sticky when scrolling. Can someone point me in the direction of the specific js files/functions that control and calculate the menu …
Category: Web

How to implement Polylang functions in my theme's php file?

I am translating a site with Polylang that was created by someone else using a custom theme. Some strings couldn't be found by Polylang, so I need to manually register them for Polylang to see. Now, some of the strings were pretty easy to translate using __(): $args = shortcode_atts([ 'link' => 'service', 'text' => __('Get the code now!'), 'title' => __('Code'), 'id' => '', 'class' => 'width300', ], $args, '' ); But I don't know how to translate strings …
Category: Web

How can I improve the recall of a certain class in a multiclass-classification result

I am working on a multiclass classification which is to assign medical related queries of web search to certain departments of hospital.My classifier is based on the fastText. I found for most conditions, the result is good enough say recall is 0.8 for Nephrology. However, for just one department, Dermatology, the recall is pretty low,like 0.5. Unfortunately, this label has most samples in the test data. How can I improve the recall of one class while maintain the performance of …
Category: Data Science

How to pass multiple parameter in add_action()

I have below code. add_action( 'admin_init', [$this, 'settings_page_registration'] ); I would like to use enqueue_assets function name inside add_action(). Should I use like below ? add_action( 'admin_init', [$this, 'settings_page_registration', 'enqueue_assets'] );
Category: Web

class-oembed Error

PHP Fatal error: Cannot redeclare _wp_oembed_get_object() (previously declared in /home/samdonme/public_html/wp-includes/embed.php:112) in /home/samdonme/public_html/wp-includes/class-oembed.php on line 692 embed.php:112 function _wp_oembed_get_object() { static $wp_oembed = null; oembed.php on line 692 function _wp_oembed_get_object() { static $wp_oembed = null; if ( is_null( $wp_oembed ) ) { $wp_oembed = new WP_oEmbed(); } return $wp_oembed; As you see above, I am have problem with the embed.php and class-oembed.php. When I delete form setting.php require( ABSPATH . WPINC . '/class-oembed.php' ); problem is fixed. But I want to …
Category: Web

Sampling labeled data for anomaly detection

I'm currently working on a project that requires the use of unsupervised anomaly detection, but I'm unable to find a relevant data set, so I'm considering the following option: Assuming I have a data set $X$ of $m$ examples labeled using $K$ classes. Let $X(k)$ be the subset of $X$ where all examples are labeled as $k$, and $k_{max}$ be the larget class. Can I use $X(k_{max})$ as a training set for an anomaly detector, whose task is to flag …
Category: Data Science

Siamese Network for face comparison wont learn, accuracy stuck on 0.5, and loss stuck too

I'm trying to train a siamese network which contains a CNN and an embedding layer at the end to yield 2 similar (close) vectors for 2 images of the same person. I'm using the LFW_Cropped dataset, and some custom made generators. The generators are tested and returns batches of 50% 50% Same and Different pairs of images with the correct label. The labels for same and different outcome are: SAME = 1 -> (named as 'yes' in my code) DIFFERENT …
Category: Data Science

Displaying subcategories and then posts in taxonomy template

I have a custom post type 'downloads' which i have a have a custom template set up to get terms of to begin with. Im now trying to set up my taxonomy template so that it displays sub-categories if there are any, but if not to show posts for that term. Below is what my taxonomy template includes so far and this works fine to the point that it displays the child categories, but it doesnt then show the posts …
Category: Web

How is the output of a maxpool layer window size=1x2 and stride=2 calculated?

I'm looking at the architecture proposed in the following paper: Baoguang Shi et al, An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition. In the proposed architecture of the model, a MaxPooling Window:1 × 2, s:2 layer is mentioned. I'm not sure what the size of the output of this layer would be. If i have an input of size (32 x 8), then the output would be: (32-1)/2 + 1 = 16.5, …
Category: Data Science

DISALLOW_FILE_EDIT is false but I still am not able to edit files from the admin interface and the menus do not show up

I have checked the constant DISALLOW_FILE_EDIT and it's set to false. I am using Trellis to setup my sites, and it is working correctly on my actually staging server VPS. But on the local virtual machine it's not working. Looking for help in how I can debug this, what source file or WP to check ... I assume this has something with the NFS shared folders mechanic the files are shared across the host OS and guest VM. Host OS …
Category: Web

Always show wordpress submenu on responsive header menu

I'm trying to edit my CSS to always show all the li tags inside my header menu, also with ul.sub-menu li; I just want to show all the items from the menu, but I'm working on it for hours and I've still haven't found any solution. This is my menu's structure: <ul class="menu"> <li>Item</li> <li> Item 2 <ul class="sub-menu"> <li>Subitem</li> <li>Subitem 2</li> </ul> </li> <li>Item 3</li> <li>Item 4</li> </ul> This is what I've tried so far: ul.menu li ul.sub-menu { …
Category: Web

Call function from one class in the same class

I have 2 classes model and impute. I am defining a function mode_impute inside impute. Now I want to call mode_impute inside impute. How can I call it? I tried the following: class impute(model): def __init__(self): super().__init__() pass def mode_impute(self): mode_val = self.df6[self.var].value_counts().index[0] self.df6[self.var].fillna(mode_val, inplace = True) for i in ['MasVnrType', 'BsmtQual', 'BsmtFinType1', 'GarageType', 'GarageFinish']: self.mode_impute(self.x, i) The above code gives me error NameError: name 'self' is not defined EDIT 1: I applied the changes as suggested in the comments: …
Category: Data Science

Algorithm for user profiling without distinct profiles

I am trying to design an algorithm that takes in a new user with the variables department, location, job_role etc. and I want a machine-learning algorithm to decide what software and hardware this new user would need. I am rattling my brain thinking how I could get this to work - I could use a supervised learning approach and train a model with a dataset of already employed users and the software and hardware they use, however, the variables in …
Category: Data Science

Order post by year DESC and month ASC

I have a worpresss 4.0.12 website; i created a custom template category-$id.php in which I have to show post ordering them by Year DESC and by month ASC (or a custom field ASC), the result should be something like this: 2017 Post 10-01-2017 Post 25-01-2017 Post 05-03-2017 Post 06-12-2017 2016 Post 10-01-2016 Post 05-03-2016 Post 06-12-2016 2015 [...] How can I do? I Tried width query_posts($args) but I can't order by a second field
Category: Web

Gutenberg custom block: RichText underline button

I am working on a custom block for Gutenberg and part of this block is a RichText component. I am trying to add a button that underlines the text and I cannot make it work since last night. The code I have now [does not work]: <div> <BlockControls controls={ [ { icon: 'editor-underline', title: __( 'Underline' ), onClick: () => { console.log(this.test.current, this) this.test.current.props.onChange(toggleFormat( this.test.current.props.record, { type: 'core/underline' } ) ); }, }, ] } /> <RichText tagName="p" label="Intro" className={ …
Category: Web

How to interpret arg min in the the following equation?

I am studying the following equation: $\hat{s}_m(n) = \text{arg}\text{min}_{s_m(n)\in A_s}|\frac{\psi_m^H}{||\psi_m^H||^2}y_m(n)-s_m(n)|^2$----(1) here $A_s$ is 1x$N$ vector of QPSK symbols, $s_m(n)$ belongs to $A_s$, $\psi_m$ is a random complex number, $y_m(n)$ is 1x$N$ vector and $n$ ranges from $1$ to $N$ and I have all these values. My query is what does arg min is signifying in this equation (1). Any help in this regard will be highly appreciated.
Category: Data Science

How to run list comprehensions on GPU?

Is there a way to run complex list comprehensions like the following on GPU? [[x[index] if x[index]>len(x) else x[index]-1 for x in slice] if (len(slice)==1) else slice for slice,index in zip(slices,indices)] To what degree is it Possible? Do I have to convert it to some kind of numpy comprehension (if so what part is speciffically possible/necessary) The goal is performance optimization on large datalists/arrays.
Category: Data Science

Multi Linear Regression on String Values

I'm using datasets which involves mostly of string values. The main outcome of the project is that it should predict success. Now I can use OneHotEncoding to convert string values in numerical format but the values are a lot. I'm using Multi Linear Regression and the only numerical value is of the output which is supposed to be predicted by my model. Query 1: By using sklearn, when encoding the string values, should it not take the whole resources as …
Category: Data Science

List post from current taxonomy children

I have a custom post type and a taxonomy with children, with a template file named taxonomy-productcategories.php. On this i want to list all children with their posts. Child taxonomy 1 Child taxonomy 1 Post A Child taxonomy 1 Post B Child taxonomy 1 Post C Child taxonomy 2 Child taxonomy 2 Post D Child taxonomy 2 Post E Child taxonomy 2 Post F And so on... I have an example for getting just the Child taxonomy, but i want …
Category: Web

Is there a hook or filter yet for Gutenberg Block Editor to not auto-add Noreferrer to links with a target?

Wordpress adds "noreferrer" to all links that open in a new tab. This started before Gutenberg and a TinyMCE filter was provided to fix it. This no longer works for Gutenberg. They have a new wp_targeted_link_rel filter too that only works for the classic editor. I manually removed it from all my links and all was fine on WP 5.0. Upon updating to WP 5.1 it was added back to all of my links after updating the posts. This is …
Category: Web

About

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