I have a set of data with some numerical features and some string data. The string data is essentially a set of classes that are not inherently related. For example: Sample_1,0.4,1.2,kitchen;living_room;bathroom Sample_2,0.8,1.0,bedroom;living_room Sample_3,0.5,0.9,None I want to implement a classification method with these string-subclasses as a feature; however, I don't want to have them be numerically related or have the comparisons be directly based on the string itself. Additionally, if samples have no data in this column they should not be …
I have composed a customized loss function (kl_loss): def tensor_pValue(pnls,pnl): vec=tf.contrib.framework.sort(pnls,axis=-1,direction='ASCENDING') rank_p=tf.divide(tf.range(0,264.5,1),264.0) return tf.gather(rank_p, tf.searchsorted(vec,pnl,side='left')) def kl_divergence(p, q): epsilon = 0.00001 p=p+epsilon q=q+epsilon return tf.reduce_sum(p * tf.log(p/q)) def kl_loss(predicted_pnL,actual_pnl_tensor): p_dist=tf.squeeze(tf.map_fn(lambda inp:tensor_pValue(inp[0],inp[1]),(predicted_pnL,actual_pnl_tensor),dtype=tf.float32)) u_dist=tf.random.uniform([264],0,1,dtype=tf.float32) return kl_divergence(p_dist,u_dist) And then i constructed a simple net work using Keras: optimizer = tf.train.AdamOptimizer(0.001) input_dim = X_train.shape[1] model = keras.Sequential([ keras.layers.Dense(UNITS, activation=tf.nn.relu, input_dim=input_dim), keras.layers.Dense(UNITS, activation=tf.nn.relu), keras.layers.Dense(264) ]) model.compile(loss=lambda y, f: kl_loss(f,y), optimizer=optimizer) model.fit(X_train, train_y, epochs=EPOCHS, batch_size=BATCH_SIZE,verbose=0) And got following errors: ValueError: No gradients provided for any variable: …
I have this code which has taken over 7 hours to put together through research but the last hours or so I have hit a brick wall! I require the taxonomy title to be hidden if there are no posts associated with it. Here is the page: http://cb.dannycheeseman.me/wine-menu/usa/california/ Here is my code: /**********************************************/ // CUSTOM WINE MENU SHORTCODE /**********************************************/ add_shortcode( 'wine_list_per_cat', 'wine_list_per_cat' ); function wine_list_per_cat($atts){ global $woocommerce_loop; extract(shortcode_atts(array( 'cat' => '', // list of categories in the format 0,1,2,3,4 'tax' …
If you train your YOLO model only on grayscale images to detect car, then would it able to recognise a car in a colored image also. If so, then can I assume that YOLO consider only object shape not color? Kindly clarify.
I would like to use the rest API to take a username and a password sent in a request and use it in wp_authenticate() then send back if the credentials were correct. How would I do this.
Yesterday, I found out that a website I worked on as a writer (I have no admin access) had been injecting malicious Javascript code in all its pages, as described in this article by Luke Leal. According to that article, a fake Wordpress plugin musts have been installed on that website to inject the malicious code. I want to draw your attention to this section of the malicious code: // This code is defined inside a PHP class... function save_striplple_plugin() …
I am trying to create a simple 'add monthly Subscriptions(Monthly payments) button' custom plugin for a clients Wordpress website. My current issue is how am I to include Stripe's PHP library in the plugin? I have Stripe operational running it through Composer (autoload.php) locally. But adding it to Wordpress.... I have added the basic code from Stripe's website below: https://stripe.com/docs/recipes/subscription-signup <form action="/create_subscription.php" method="POST"> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="pk_test_mlHAlLZMWfb2URJZIvb6Qntd" data-image="/images/marketplace.png" data-name="Emma's Farm CSA" data-description="Subscription for 1 weekly box" data-amount="2000" data-label="Sign Me Up!"> …
I'm building an OCR to read text off of water meters. I'm running into the error mentioned above when I try to fit the machine learning model. I am using the segmentation_models python library. BACKBONE = 'resnet34' preprocess_input = sm.get_preprocessing(BACKBONE) x_train, y_train, x_val, y_val = train_test_split(X,y, test_size = 0.2, random_state= 12345) x_train = preprocess_input(x_train) x_val = preprocess_input(x_val) model = sm.Unet(BACKBONE, encoder_weights='imagenet', encoder_freeze=True) model.compile('Adam', loss=sm.losses.bce_jaccard_loss, metrics=[sm.metrics.iou_score]) model.fit( x = x_train, y = y_train, batch_size=16, epochs=10, validation_data=(x_val, y_val)) 'X' represents the images …
I have an issue in my custom theme. Direct media library upload saving in wrong month date folder (2017/03) when current date is 2018/09. But when I upload images through post it goes to the correct folder. I have tested in default theme, Direct media library upload goes to the correct folder. So the issue is in my custom theme. But I am not sure where to look at. In which file of my theme has the issue? Help is …
Is there such thing as a spunding valve for a demijohn or swing-top bottle? I want to make elderflower champagne for the second time. Last year it was fermented in plastic bottles, and one of them exploded. I figured there must be some sort of equivalent of an airlock that releases above a certain pressure, and thus I discovered that spunding valves are a thing. However, it seems that spunding valves are made only for kegs, and specialised pressurised fermentation …
I have been exploring clustering algorithms (K-Means, K-Medoids, Ward Agglomerative, Gaussian Mixture Modeling, BIRCH, DBSCAN, OPTICS, Common Nearest-Neighbour Clustering) with multidimensional data. I believe that the clusters in my data occur across different subsets of the features rather than occurring across all features, and I believe that this impacts the performance of the clustering algorithms. To illustrate, below is Python code for a simulated dataset: ## Simulate a dataset. import numpy as np, matplotlib.pyplot as plt from sklearn.cluster import KMeans …
If you train an agent using reinforcement learning (with Q-function in this case), should you give a negative reward (punish) if the agent proposes illegal actions for the presented state? I guess over time if you only select from between the legal actions, the illegal ones would eventually drop out, but would punishing them cause them to drop out sooner and possibly cause the agent to explore more possible legal actions sooner? To expand on this further; say you're training …
How can you leverage wp_set_auth_cookie to programmatically login a user on a specific blog in a multisite environment? wp_set_auth_cookie doesn't allow you to set the target blog to authenticate the user under. I have a multisite/buddypress setup where activations happen on the primary domain. I want to then automatically authenticate that user not for the main site, but for one his site that was created on registration.
I am trying to analyze a temporal signal sampled by a 2D sensor. Effectively, this means integrating the signal values for each sensor pixel (array row/column coordinate) at the times each pixel is active. Since the start time and duration that each pixel is active are different, I effectively need to slice the signal for different values along each row and column. # Here is the setup for the problem import numpy as np def signal(t): return np.sin(t/2)*np.exp(-t/8) t = …
I am working on training RNN model on caption generation with REINFORCE algorithm. I adopt self-critic strategy (see paper Self-critical Sequence Training for Image Captioning) to reduce the variance. I initialize the model with a pre-trained RNN model (a.k.a. warm start). This pre-trained model (trained with log-likelihood objective) got 0.6 F1 score in my task. When I use adam optimizer to train this policy gradient objective, the performance of my model drops to 0 after a few epochs. However, if …
History: I'm working on a project for a client that involves building 27 unique websites that are built on wordpress. I say unique, because (for reasons that are not worth going into here) they aren't and can't be installed in a multi-site environment. Each of these sites will have the same theme installed and one or two custom plugins as well. I can't use the WordPress theme directory, because the theme is specifically built for my client and won't work …
we had our Wordpress page running on example.com. But now, we're developing new React website, which already has some of the webpages ready. We use Vercel to host that React website. We want React/Vercel to host specific pages (which are already developed) and serve the wordpress page as a fallback. E.g.: React already has page example.com/pageA ready, so we want that URL to be served directly by Vercel/React. On the other hand, React doesn't has page example.com/pageB ready, so we …
This code uses Taxonomy Images plugin to display images for categories. This code display subcategories of main category in parent category page (category.php), But I want to display only one level of subcategory in the page for example hardware (parent category) monitor (first level subcategory of harware) samsung (second level subcategory) lcd (third level subcategory ) When the user clicks on the hardware link, he should see only monitor subcategory link and in second time when he clicks on the …
I need to predict technical aggregate condition using vibration monitoring data. We consider this data to be nonstationary i.e. distribution parameters and descriptive statistics are not constant. I found that one of the best algorithms for such tasks in Learn++.NSE and we us it with MLP as a base classifier. As I know, it's necessary no normalize data for operations with ANN. We decided to normalize using mean, stdev and sigmoidal function. We train networks of ensemble with sets with …
I'm trying to make a customized registration page in front end, but when I try to reload the page in error/success case it display that message in chrome: Confirm Form Resubmission The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue? my code : the_post();//Iterate the post index in the loop. get_header(); $err = ''; $success = ''; global $wpdb, $PasswordHash, …
I have this location on my server. /home/localhost/public_html/wp-includes/SimplePie. I have not installed Simplepie plugin. What is it used for since it is not associated with Simplepie plugin. The reason I ask is that, I have fatal error generated from different php files in that location. Each time I debug the error a new error in different file which is at the same location is created. Later I found that it was associated with a plugin. I have removed the plugin …
I have to work with a dataset where people ostensibly had the option to check several options to a question (eg "check all that apply"). But in the data, all of the options when selected are shown under one variable where they look like "option1_option2" instead of having created different variables for option 1/option 2 etc when selected. Is there an easy way to create separate variables based on this? I don't know how to select criteria from these kinds …
I am not sure if there is a simple solution to my problem. The requirement looks simple but unable to find answer even after breaking my head for 6 hours. I have to pass variable from a php function to a shortcode and this shortcode has to pass on the this variable to another shortcode. Shortcode-1 will open a popup and the content of the popup is created by shortcode-2, content has to be changed based on the variable. How …
I am relatively new to the world of personal home brewing. I have always gravitated towards mead and my next venture ought to be distilling some. I've read through lots of articles and threads on the topic and to no end have I found something agreed upon on the issue. Every other spirit has its own category based on its original ingredient, the process, or a slice of historical origin. Why on earth has distilled honey ferment not have a …
I am using ggplot, to compare 114 unique studies for a particular variable I'm interested in. This is what I have used. ggplot(steps, aes(x=factor(edu))) + geom_bar(aes(y = (..count..), group = id_study,)) + facet_wrap(~id_study,) Whilst this works, all 114 studies are plotted on one page and the formatting is all squashed. How do I split this over 4x4 pages ? Many thanks S edit **** As there are 114 unique studies, I have 5 pages in total 1) ggplot(steps, aes(x=factor(edu))) + …
I would like to create word embeddings that take context into account, so the vector of the word Jaguar [animal] would be different from the word Jaguar [car brand]. As you know, word2vec only gives one representation for a given word, and I would like to take already pretrained embeddings and enrich them with context. So far I've tried a simple way with taking an average vector of the word and category word, for example like this. Now I would …
I have two machine learning model, the model result different error value in MAE and MSE. M1 have smallest MAE, but M2 have smallest MSE. Can anyone explain to me, why this happen? I also add my actual and predicted data here. Thank You
Suppose I seek to predict a certain numerical value, whereby the data set which contains the predetermined correct labels is only very small. However, I'm also provided a large data set with a label that is correlated to the one I want to predict. I read that transfer learning could be used to make use of this larger data set for predicting the desired label from the smaller data set. Could someone elaborate a bit on this?
I'm trying to do prediction on capacity column, however each data point consist of more data. Each data point represent a cycle data. Each cycle has a capacity. Each cycle runs for some time duration, and in that duration some data is collected over which capacity is dependant I tried exploding the dataset and copying the capacity values to each row, but that shouldn't be the case because each row will get different capacity predicted. Is there a way to …
Actually it is more general question but now i am trying to use it on wordpress site so I preferred to post it here. I am trying to understand the difference between remote post and form post. When I query a string and post it to remote server, I get the result as string and with "print $response" see it on browser console. But I want it to be displayed as html on browser. Am I expecting wrong thing or …
Fine tuning is a concept commonly used in deep learning. We may have a pre-trained model and then fine-tune it to our specific task. Does that apply to simple models, such as logistic regression? For example, let's say I have a dataset with attribute variables of an animal and I want to classify whether or not it is a mammal or not. The labels on that dataset are only "mammal"/"not mammal". I then train a logistic regression model for this …
cat = {'A':1, 'B':2, 'C':3} dog = {'A':2, 'B':2, 'C':4} owl = {'A':3, 'B':3, 'C':3} Suppose I have 3 dictionary, each containing pairs of (subcategory, count). How can I plot a segmented bar chart (i.e stacked bar graph) using Python with x being 3 categories (cat, dog, owl) and y being proportion (of each subcategory)? What I have in mind looks like this:
Is it possible to create a table with the wpdb::prepare function? I read the documentation and tried to find examples but there where none that helped me. Even creating a table with prepare doesn't give me any useful examples on Google. Currently I'm creating my table like this: public function createTableFromFields( $tablename, $fields ) { // $wpdb = $this->db; $tablename = $wpdb->prefix . $tablename; $sql = 'CREATE TABLE IF NOT EXISTS ' . $tablename . ' (id INT(6) UNSIGNED AUTO_INCREMENT …
I have a huge amount of multiindexed data that, very simplified, looks like this: Code: channel_list = ['A','B','C'] df1=pd.DataFrame([[1.1,4,9],[1.2,5,9],[1.3,6,9],[1.4,7,9]],columns=pd.MultiIndex.from_product([['Test1'],channel_list],names = ['Test ID','Channel'])) df2=pd.DataFrame([[1.1,9,6],[1.2,8,6],[1.3,7,6],[1.4,6,6]],columns=pd.MultiIndex.from_product([['Test2'],channel_list],names = ['Test ID','Channel'])) df3=pd.DataFrame([[1.1,1,4],[1.2,2,4],[1.3,3,4],[1.4,4,4]],columns=pd.MultiIndex.from_product([['Test3'],channel_list],names = ['Test ID','Channel'])) df4=pd.DataFrame([[1.1,7,9],[1.2,6,9],[1.3,5,9],[1.4,4,9]],columns=pd.MultiIndex.from_product([['Test4'],channel_list],names = ['Test ID','Channel'])) df5=pd.DataFrame([[1.1,9,9],[1.2,8,9],[1.3,7,9],[1.4,6,9]],columns=pd.MultiIndex.from_product([['Test5'],channel_list],names = ['Test ID','Channel'])) df6=pd.DataFrame([[1.1,1,5],[1.2,2,5],[1.3,3,5],[1.4,4,5]],columns=pd.MultiIndex.from_product([['Test6'],channel_list],names = ['Test ID','Channel'])) df7=pd.DataFrame([[1.1,2,1],[1.2,3,1],[1.3,4,1],[1.4,5,1]],columns=pd.MultiIndex.from_product([['Test7'],channel_list],names = ['Test ID','Channel'])) df8=pd.DataFrame([[1.1,4,3],[1.2,5,3],[1.3,6,3],[1.4,7,3]],columns=pd.MultiIndex.from_product([['Test8'],channel_list],names = ['Test ID','Channel'])) df_all=pd.concat([df1,df2,df3,df4,df5,df6,df7,df8],axis=1).T My goal is to cluster the data by the highest level 'Test ID', so for example: Cluster 1: Test1, Test3, Test6, Test7, Test8 Cluster 2: Test2, Test4, Test5 In …