I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show images and videos only, it's showing everything. Any ideas on what might be wrong? Thanks in advance JS: $( '#add_item' ).on( 'click', function( e ) { var $el = $( this ); e.preventDefault(); // If the media frame already exists, reopen it. if ( …
I am using AJAX to load next set of posts on homepage. The posts load fine but the shortcodes are not rendered. I am trying to use the do_shortcode function on the content the ajax call fetches (although experts have suggested not to use do_shortcode) but apparently it is failing. Here's my function that processes the request: function theme_load_more_posts() { check_ajax_referer( 'theme-load-more-posts-nonce', 'nonce' ); $args = isset( $_POST['query'] ) ? array_map( 'esc_attr', $_POST['query'] ) : array(); $args['post_type'] = isset( $args['post_type'] …
I am working on implementing a scalable pipeline for cleaning my data and pre-processing it before modeling. I am pretty comfortable with the sklearn Pipeline object that I use for pre-processing but I am not sure if I should include data cleaning, data extraction and feature engineering steps that are typically more specific to the dataset I am working on. My general thinking is that the pre-processing phase would include operations on the data that need to be done after …
I have a custom post type called Hotels which I woud like to link to using the below url structure: /{country}/{state}/{hotel-name} I am fetching and inserting posts dynamically, so I do not know the number of countries/states. The Hotel Name is the slug version of the post title. I have been banging my head all day trying to get it to work. The below code works to make the links look correct, but then 404s on all posts: function change_link($permalink, …
I made a website with WordPress and Codeigniter. I create 4 pages on Codeigniter then one more blog page in WordPress. I get the footer data dynamically on the Codeigniter based site. I need to take the same footer data dynamically on my WordPress pages.
I'm very new to data science (this is my hello world project), and I have a data set made up of a combination of review text and numerical data such as number of tables. There is also a column for reviews which is a float (avg of all user reviews for that restaurant). So a row of data could be like: { rating: 3.765, review: `Food was great, staff was friendly`, tables: 30, staff: 15, parking: 20 ... } So …
I have set up an archive page for my custom post type reference, where I use a query to get all posts of type reference. This works, but when I try to paginate the result, it doesn't work. Right now, it doesn't even print out the pagination links. EDIT: This was earlier used on a regular page, but I changed it to an archive page. That's when the pagination broke. Here is the source code; Custom post type reference (plugin) …
This is something I have been wondering for ages but I am never able to get an answer. I am trying to understand how to make a dataframe in R, where each element of the dataframe is itself a vector or a matrix. For example, lets say we have a regular vector V with elements being real numbers. Then to acess any number we would have V[3] which would give the third element of said vector. Now I want to …
I am currently working on a machine learning project where I use the YOLO Algorithm to detect an object inside of a picture or video. The problem I face is that the specific image set (side-scan sonar) that I am working with is mostly classified, thus there is not a wide range of images available to the public to be used for training. Would I be able to implement a GAN to produce a larger data-set of side-scan sonar imagines …
I have a custom URL like this: website.com/show/?id=9999&n=page-name and I'm trying to come up with a mod_rewrite rule to convert to website.com/show/9999/page-name/ /show/ is a page name. Here's the rules I'm using in .htaccess: <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteRule ^show/(.*)$ /show/?id=$1 [R=301,NC,QSA] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> This is working, it rewrites website.com/show/?id=9999` to website.com/show/9999/ Then I modified the rule for the second query string: RewriteRule …
I am currently using transaction amount as a feature in an XGBoost classification model designed to identify fraudulent transactions. Furthermore, transaction amount is bounded for this problem between 0 and 500. Using transaction amount as a feature does improve target class separability. However, I can't help but wonder if there is a better way to use this variable. To explain, I care more about getting the high transaction amount values correct than I do the low ones. However, the model …
I was wondering if spaCy supports multi-GPU via mpi4py? I am currently using spaCy's nlp.pipe for Named Entity Recognition on a high-performance-computing cluster that supports the MPI protocol and has many GPUs. It says here that I would need to specify the GPU to use with cupy, but with PyMPI, I am not sure if the following will work (should I import spacy after calling cupy device?): from mpi4py import MPI import cupy comm = MPI.COMM_WORLD rank = comm.Get_rank() if …
I'm trying to set up individual, one-time schedule events in a plugin. No matter what I do, I can't seem to get the events to fire. I'm using the Cron View plugin to see what's in queue, and the events are added and remove themselves totally on schedule. I never, however, receive the email I've set to send in the action's target function (simply in order to test the event, there will be more in there later). I have tested …
I have adjacent posts set up correctly but it's displaying all of the posts/pages. I need it to show specific ones. The easiest way would be by parent URL if that's possible as I need to do this multiple times. So www.example.com/sydney/ would be the URL and every page that uses the sydney parent would be displayed and nothing else. It doesn't have to be this way if there is a better/easier way then I am all ears. /** * …
My goal is to get wp_editor working in a simple widget which the admin can use to add text content on an admin options page. Here we go in wp-admin/widgets.php everything looks sooo good right. When we try to save... Oh no..... Buttons are gone and the Visual tab no longer works When I look at the HTML it appears as though after updating TinyMCE just decides it doesn't need to load any buttons... Any ideas? Edit: here's the source …
I want to implement an efficient and vectorized Maxout activation function using python numpy. Here is the paper in which "Maxout Network" was introduced (by Goodfellow et al). For example, if k = 2: def maxout(x, W1, b1, W2, b2): return np.maximum(np.dot(W1.T,x) + b1, np.dot(W2.T, x) + b2) Where x is a N*D matrix. Suppose k is an arbitrary value(say 5). Is it possible to avoid for loops when calculating each wx + b? I couldn't come up with any …
I have a deep-q reinforcement learning model, and when i train it with neural network A, I get high scores - 2-3x better than random (score for random is avrg 0 per step, completing the task after 223000 steps, score for this is 1-2 per step, completing in more like 80000 steps). The reported Mean absolute error for this ranges in the 200-250 range, and the loss at something like 2000 - 2100. When i train with neural network B, …
I want to build a face GAN, but I want to be able to control the 'camera angle' of the generated image, and I also want the subject (the generated face) to be the same every time. If the above is possible, then it seems like it could generate the variety of angles necessary for something like photogrammetry. Is this possible? How would I implement the constraints?
i have one question reagrding CNNs , if we take a signle convolutional layer it can have multiple filters right ? are these filters all the same ? is a single layer made only to detect one feature ? i'm a bit confused of the working of convolutional layer.
Custom quicktags not working after Wordpress 6.0 wp 5.8.x/5.9.x: working -- wp 6.0: not working Buttons are not showing here: https://imgur.com/a/T05o0WX Console error: Uncaught ReferenceError: QTags is not defined I am using this code. function my_quicktags() { if ( wp_script_is( 'quicktags' ) ) { ?> <script type="text/javascript"> QTags.addButton( 'eg_php', 'PHP', '<pre><code class=\"language-php\">', '</code></pre>', 'p', 'PHP Code', 200 ); QTags.addButton( 'eg_css', 'CSS', '<pre><code class=\"language-css\">', '</code></pre>', 'q', 'CSS Code', 201 ); QTags.addButton( 'eg_html', 'HTML', '<pre><code class=\"language-html\">', '</code></pre>', 'r', 'HTML Code', 202 ); …
I am using a custom post-type, in post there are a checkbox meta field for featured post. So there are two scenarios. First with featured posts Second with non featured When I called featured posts with meta_query its result 100% perfect. Here is my code: $c_clients_args = array( 'post_type' => 'clients_testimonials', 'posts_per_page' => 6, 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'c_client_feature', 'value' => 'on' ) ) ); $c_clients_result = new WP_Query($c_clients_args); if($c_clients_result->have_posts()) : while($c_clients_result->have_posts()) : $c_clients_result->the_post(); // …
I appreciate the fact that Jupyter runs in an isolated mode. I read several posts about it by now. What I don't understand is why the JUPYTER_PATH variable is ignored as well as appending manually (as a proof of concept) the path of the current site packages from my brewed Python dir. I couldn't find any documentation specific for the Lab so I assumed this should have worked out of the box. Any idea on how to avoid installing all …
I was reading an article that mentioned reasons why tanh is better than sigmoid and one reason was that tanh gives zero-centered data but I couldn't understand why and how it will affect our network. kindly give math light, intuitive answers.
my current search only shows POSTS as results. http://newslines.org/?s=george My site has categories for George Clooney, George R.R. Martin etc. How do I get a list of categories that match the search term to show at the top of the results page? I have tried this: <?php $search_query = get_search_query(); $term = get_term_by( 'name', $search_query, 'category' ); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ echo "<ul>"; foreach ( $terms as $term ) { echo "<li>" . $term->name …
I like this solution from Ahmad M, a lot, but how do I add images in addition to titles, instead of replacing titles? (Sorry, I'm still pretty new to PHP and Stackexchange). Pulling Featured Images in to a WordPress Menu I mostly figured it out. I'm using Ahmad M's filter but needed to add ".$menu_object->title" to the thumbnail so now it looks like: $menu_object->title = has_post_thumbnail($menu_object->object_id) ? get_the_post_thumbnail($menu_object->object_id, 'full') . $menu_object->title . : $menu_object->title; Now my challenge is that I …
I have four different feature selection techniques, Backwards Elimination, Lasso, feature_importances, and Recursive feature selection. Each technique returns slightly different results. For example, Backwards Elimination: Spread Direction Lasso: Spread Move, and Spread Feature_Importances_: Spread Percentage and Spread Money Recursive: Spread Money is there a standard method when choosing features from different models? Should you choose the features that each model returns or is there a preferred method when doing this?
In case I receive only standard deviation from a sensor of a value $v$ (that is btw normally distributed) each 4th minute but need to provide a standard deviation $\sigma$ for each 15 minutes is there a safe way to do it. There are two things that came into my mind: 1) One and safe way is to get the mean, generate possible values using standard deviation of the 4 minute interval for the 15 minutes period (15*60 values). Calculate …
I am using the front end form submission. It works on localhost perfectly, but it's not working when my site is live. It shows the "success message", but originally it's not logged in. This is my code: if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'log-in' ) : global $error; $login = wp_login( $_POST['user-name'], $_POST['password'] ); $login = wp_signon( array( 'user_login' => $_POST['user-name'], 'user_password' => $_POST['password'], 'remember' => $_POST['remember-me'] ), false ); if (!$error) { save_message( …
I've been asked to review a paper in which the authors compare their new model (let's call it Model A) to other models (B, C, and D), and conclude theirs is superior on some metric (I know, big surprise!). Here's the problem: in my research, my supervisors always instructed me to code up the competing models and compare my model that way. The paper I'm reviewing, by contrast, just quotes results from previous literature. To clarify, here's what I would …
Hi all I am resorting to you to figure out where the gradient and the loss for q,k,v weights update happens in Vision Transformers. I suspect it is the MLP/FF bit of the architecture but I am not confidently sure. I attach some code from lucidrains import torch from torch import nn from einops import rearrange, repeat from einops.layers.torch import Rearrange # helpers def pair(t): return t if isinstance(t, tuple) else (t, t) # classes class PreNorm(nn.Module): def __init__(self, dim, …
I read that euler number is the Number of objects in the region minus the number of holes in those objects , it should then return an integer. why does it return values like 54.25
We are a group of doctors trying to use linguistic features of "Spacy", especially the part of speech tagging to show relationships between medical concepts like: 'Femoral artery pseudoaneurysm as in ==> "femoral artery" ['Anatomical Location'] --> and "pseudoaneurysm" ['Pathology'] We are new to NLP and spacy, can someone with experience with NLP and Spacy explain if this is a good approach to show these relationships in medical documents? If not what are the other alternative methods? Many thanks!
So I just used BERT pre-trained with Focal Loss to classify Physics, Chemistry, Biology and Mathematics and got a good f-1 macro of 0.91. It is good given it only had to look for the tokens like triangle, reaction, mitochondria and newton etc in a broader way. Now I want to classify the the Chapter Name also. It is a bit difficult task because when I trained it on BERT for 208 classes, my score was almost 0. Why? I …
At the moment I have this piece of code which cuts a Spectogram into fixed length tensors: def chunks(l, n): """Yield successive n-sized chunks from l.""" for i in range(0, len(l[0][0]), n): if(i+n < len(l[0][0])): yield X_sample.narrow(2, i, n) The following piece of code downsamples the Audio Creates Mel_Spectograms and takes the log of it Applies a Cepstral Mean and Variance Normalization Then it cuts the spectogram with the code above into a fixed size of length and appends it …
i'm working on a WordPress plugin and i'm trying to display/get the post thumbnail below the post on my "Related posts" part. I tried many things which are supposed to work but not for me ... here is the code (on my plugin.php file): add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); if ( has_post_thumbnail() ) { echo ('there is a thumbnail'); echo get_the_post_thumbnail(get_the_ID(), "thumbnail"); // nothing echo get_the_post_thumbnail(); // nothing echo var_dump(get_the_post_thumbnail(get_the_ID(), "thumbnail")); //string '' (length=0) echo var_dump(get_the_post_thumbnail()); //string '' …