Search Results

Search found 68 results on 3 pages for 'preprocessing'.

Page 1/3 | 1 2 3  | Next Page >

  • Neural network input preprocessing

    - by TND
    It's clear that the effectiveness of a neural network depends strongly on the format you give it to work with. You want to preprocess it into the most convenient form you can algorithmically get to, so that the neural network doesn't have to account for that itself. I'm working on a little project that (surprise!) is going to be using neural networks. My future goal is to eventually use NEAT, which I'm really excited about. Anyway, one of my ideas involves moving entities in continuous 2D space, from a top-down perspective (this would be a really cool game AI). Of course, unless these guys are blind, they're going to be able to see the world around them. There's a lot of different ways this information could be fed into the network. One interesting but expensive way is to simply render a top-down "view" of things, with the entities as dots on the picture, and feed that in. I was hoping for something much simpler to use (at least at first), such as a list of the x (maybe 7 or so) nearest entities and their position in relative polar coordinates, orientation, health, etc., but I'm trying to think of the best way to do it. My first instinct was to order them by distance, which would inherently also train the neural network to consider those more "important". However, I was thinking- what if there's two entities that are nearly the same distance away? They could easily alternate indexes in that list, confusing the network. My question is, is there a better way of representing this? Essentially, the issue is the network needs a good way of keeping track of who's who, while knowing (by being inputted) relevant information about the list of entities it can see. Thanks!

    Read the article

  • Preprocessing incoming mail with fetchmail/procmail/mutt

    - by KAction
    I use fetchmail-procmail-mutt programms to all my mail. Some of mail generated automatically and some people not smart enough, so I would like to reformat mail body with some script. My best guess is that I should do it with procmail. But I found no such rule, best thing I found is possibility to pipe mail to programm. Of course, I can resend it with flag that no futher formatting needed, but it does not look like right solution. EDIT: Just discovered maildrop. Maybe, it is simpler to do my task with it?

    Read the article

  • C Language preprocessing doubt

    - by khanna_param
    Hi, There are different kind of macros in C language, nested macro is one of them. Considering a program with the following macro define HYPE(x,y) (SQUR(x)+SQUR(y)) define SQUR(x) (x*x) using this we can successfully complile to get the result. My question:- As we all know the C preprocessor replaces all the occurrence of the identifiers with the replacement-string. Considering the above example i would like to know how many times the C compiler traverses the program to replace the macro with the replacement values. I assume it cannot be done in one go. Thanks.

    Read the article

  • C++ preprocessing error in the code

    - by mkal
    #include "iostream" #include "string" using namespace std; #define AA(bb) \ string(::##bb); int main (int argc, char *argv[]) { AA(aa); } This gives me a bunch of errors but I am trying to understand this error pre.cpp:11:1: error: pasting "::" and "aa" does not give a valid preprocessing token Any ideas?

    Read the article

  • Django1.1 model field value preprocessing before returning

    - by Satoru.Logic
    Hi, all. I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content = NoteContentField(max_length=256) NoteContentField is a custom sub-class of CharField that override the to_python method in purpose of doing some twitter-text-conversion processing. class NoteContentField(models.CharField): __metaclass__ = models.SubfieldBase def to_python(self, value): value = super(NoteContentField, self).to_python(value) from ..utils import linkify return mark_safe(linkify(value)) However, this doesn't work. When I save a Note object like this: note = Note(author=request.use, content=form.cleaned_data['content']) note.save() The conversed value is saved into the database, which is not what I wanna see. What I'm trying to do is to save the raw content into the database, and only make the conversion when the content attribute is later accessed. Would you please tell me what's wrong with this? Thanks to Pierre and Daniel. I have figured out what's wrong. I thought the text-conversion code should be in either to_python or get_db_prep_value, and that's wrong. I should override both of them, make to_python do the conversion and get_db_prep_value return the unconversed value: from ..utils import linkify class NoteContentField(models.CharField): __metaclass__ = models.SubfieldBase def to_python(self, value): self._raw_value = super(NoteContentField, self).to_python(value) return mark_safe(linkify(self._raw_value)) def get_db_prep_value(self, value): return self._raw_value I wonder if there is a better way to implement this?

    Read the article

  • Django model field value preprocessing before returning

    - by Satoru.Logic
    Hi, all. I have a Note model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content = NoteContentField(max_length=256) NoteContentField is a custom sub-class of CharField that override the to_python method in purpose of doing some twitter-text-conversion processing. class NoteContentField(models.CharField): __metaclass__ = models.SubfieldBase def to_python(self, value): value = super(NoteContentField, self).to_python(value) from ..utils import linkify return mark_safe(linkify(value)) However, this doesn't work. When I save a Note object like this: note = Note(author=request.use, content=form.cleaned_data['content']) The conversed value is saved into the database, which is not what I wanna see. Would you please tell me what's wrong with this? Thanks in advance.

    Read the article

  • Python preprocessing imports

    - by FiloSottile
    I am managing a quite large python code base (2000 lines) that I want anyway to be available as a single runnable python script. So I am searching for a method or a tool to merge a development folder, made of different python files into a single running script. The thing/method I am searching for should take code split into different files, maybe with a starting __init___.py file that contains the imports and merge it into a single, big script. Much like a preprocessor. Best if a near-native way, better if I can anyway run from the dev folder. I have already checked out pypp and pypreprocessor but they don't seem to take the point. Something like a strange use of __import__() or maybe a bunch of from foo import * replaced by the preprocessor with the code? Obviously I only want to merge my directory and not common libraries.

    Read the article

  • Managing highly repetitive code and documentation in Java

    - by polygenelubricants
    Highly repetitive code is generally a bad thing, and there are design patterns that can help minimize this. However, sometimes it's simply inevitable due to the constraints of the language itself. Take the following example from java.util.Arrays: /** * Assigns the specified long value to each element of the specified * range of the specified array of longs. The range to be filled * extends from index <tt>fromIndex</tt>, inclusive, to index * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the * range to be filled is empty.) * * @param a the array to be filled * @param fromIndex the index of the first element (inclusive) to be * filled with the specified value * @param toIndex the index of the last element (exclusive) to be * filled with the specified value * @param val the value to be stored in all elements of the array * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt> * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or * <tt>toIndex &gt; a.length</tt> */ public static void fill(long[] a, int fromIndex, int toIndex, long val) { rangeCheck(a.length, fromIndex, toIndex); for (int i=fromIndex; i<toIndex; i++) a[i] = val; } The above snippet appears in the source code 8 times, with very little variation in the documentation/method signature but exactly the same method body, one for each of the root array types int[], short[], char[], byte[], boolean[], double[], float[], and Object[]. I believe that unless one resorts to reflection (which is an entirely different subject in itself), this repetition is inevitable. I understand that as a utility class, such high concentration of repetitive Java code is highly atypical, but even with the best practice, repetition does happen! Refactoring doesn't always work because it's not always possible (the obvious case is when the repetition is in the documentation). Obviously maintaining this source code is a nightmare. A slight typo in the documentation, or a minor bug in the implementation, is multiplied by however many repetitions was made. In fact, the best example happens to involve this exact class: Google Research Blog - Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken (by Joshua Bloch, Software Engineer) The bug is a surprisingly subtle one, occurring in what many thought to be just a simple and straightforward algorithm. // int mid =(low + high) / 2; // the bug int mid = (low + high) >>> 1; // the fix The above line appears 11 times in the source code! So my questions are: How are these kinds of repetitive Java code/documentation handled in practice? How are they developed, maintained, and tested? Do you start with "the original", and make it as mature as possible, and then copy and paste as necessary and hope you didn't make a mistake? And if you did make a mistake in the original, then just fix it everywhere, unless you're comfortable with deleting the copies and repeating the whole replication process? And you apply this same process for the testing code as well? Would Java benefit from some sort of limited-use source code preprocessing for this kind of thing? Perhaps Sun has their own preprocessor to help write, maintain, document and test these kind of repetitive library code? A comment requested another example, so I pulled this one from Google Collections: com.google.common.base.Predicates lines 276-310 (AndPredicate) vs lines 312-346 (OrPredicate). The source for these two classes are identical, except for: AndPredicate vs OrPredicate (each appears 5 times in its class) "And(" vs Or(" (in the respective toString() methods) #and vs #or (in the @see Javadoc comments) true vs false (in apply; ! can be rewritten out of the expression) -1 /* all bits on */ vs 0 /* all bits off */ in hashCode() &= vs |= in hashCode()

    Read the article

  • Are C++ templates just a kind of glorified macros?

    - by Gulshan
    From different comparisons among C++ templates and C#/Java generics like this one- http://stackoverflow.com/questions/31693/what-are-the-differences-between-generics-in-c-and-java-and-templates-in-c/31929#31929 I have a got a perception that, C++ templates are implemented by some kind of preprocessing, not compiling. In other words, they are just a kind of C macros. Is this right? Then I felt that, if C++ templates are implemented by preprocessing, dynamic linking(.dll) cannot be used. A quick google search also supports this. And lastly, how can we use macros in C to deliver C++ templates like functionalities? Another thing came in my mind about templates similar to some kind of preprocessor that, there can be integers passed as arguments to some templates. And it even supports kind of recursion. But the recursion is not in the assembly/machine code. So, am I wrong calling templates glorified macros? Unlike normal macros, it has some superior abilities. But isn't it a kind of preprocessing?

    Read the article

  • Android - Service and Activity interaction

    - by Chris
    I want to create an app that contains a Service S and an Activity A. The Service S is responsible for preprocessing, such as preparing the data shown on the UI of the Activity A, before the Activity A gets invoked. I want to be able to invoke the Service S from outside the package, say from another Android app's Activity class B, do the preprocessing, and then when the data is ready, invoke Activity A. My questions are: What is the best way to share data between the Service S and Activity A? How can the external activity B communicate with the Service S to determine if it has completed with all its preprocessing, and the Activity A is ready to be invoked? Thanks Chris

    Read the article

  • Forth: free video tutorials?

    - by Peter Mortensen
    Can you recommend any free Forth video tutorials (except for following) ? The only one I know of is Samuel A. Falvo's excellent "Over The Shoulder Episode 1: Text Preprocessing in Forth". MPEG. 102 MB. There are also videos from the annual Forth Day, but I don't consider those to be tutorials. (Unfortunately Forth is, like R, C, C++, Java, C#, D, COM, .NET, F# and Frontier, an unspecific search term. Search tip for Forth: qualify it with "ans" - as in ANS Forth, the ANSI Forth Standard.) Accumulated based on answers and other information: Introductions to Forth Forth. By Ben Stiglitz. At RubyConf 2008 Orlando Florida, U.S.A. 13 min 35 secs. 32 MB. MP4. Advanced Over The Shoulder Episode 1: Text Preprocessing in Forth. By Samuel A. Falvo. 1 h 06 min 25 secs. 102 MB. MPEG.

    Read the article

  • Random access gzip stream

    - by jkff
    I'd like to be able to do random access into a gzipped file. I can afford to do some preprocessing on it (say, build some kind of index), provided that the result of the preprocessing is much smaller than the file itself. Any advice? My thoughts were: Hack on an existing gzip implementation and serialize its decompressor state every, say, 1 megabyte of compressed data. Then to do random access, deserialize the decompressor state and read from the megabyte boundary. This seems hard, especially since I'm working with Java and I couldn't find a pure-java gzip implementation :( Re-compress the file in chunks of 1Mb and do same as above. This has the disadvantage of doubling the required disk space. Write a simple parser of the gzip format that doesn't do any decompressing and only detects and indexes block boundaries (if there even are any blocks: I haven't yet read the gzip format description)

    Read the article

  • Common header file for C++ and JavaScipt

    - by paperjam
    I have an app that runs a C++ server backend and Javascript on the client. I would like to define certain strings once only, for both pieces of code. For example, I might have a CSS class "row-hover" - I want to define this class name in one place only in case I change it later. Is there an easy way to include, or read, some sort of common definitions file into both C++ and JavaScript? Ideally as a compile / preprocessing step but any neat approach good.

    Read the article

  • Why are argument substitutions not replaced during rescanning?

    - by James McNellis
    Consider the following macro definitions and invocation: #define x x[0] #define y(arg) arg y(x) This invocation expands to x[0] (tested on Visual C++ 2010, g++ 4.1, mcpp 2.7.2, and Wave). Why? Specifically, why does it not expand to x[0][0]? During macro replacement, A parameter in the replacement list...is replaced by the corresponding argument after all macros contained therein have been expanded. Before being substituted, each argument’s preprocessing tokens are completely macro replaced (C++03 §16.3.1/1). Evaluating the macro invocation, we take the following steps: The function-like macro y is invoked with x as the argument for its arg parameter The x in the argument is macro-replaced to become x[0] The arg in the replacement list is replaced by the macro-replaced value of the argument, x[0] The replacement list after substitution of all the parameters is x[0]. After all parameters in the replacement list have been substituted, the resulting preprocessing token sequence is rescanned...for more macro names to replace (C++03 §16.3.4/1). If the name of the macro being replaced is found during this scan of the replacement list...it is not replaced. Further, if any nested replacements encounter the name of the macro being replaced, it is not replaced (C++03 §16.3.4/2). The replacement list x[0] is rescanned (note that the name of the macro being replaced is y): x is identified as an object-like macro invocation x is replaced by x[0] Replacement stops at this point because of the rule in §16.3.4/2 preventing recursion. The replacement list after rescanning is x[0][0]. I have clearly misinterpreted something since all of the preprocessors I've tested say I am wrong. In addition, this example is a piece of a larger example in the C++0x FCD (at §16.3.5/5) and it too says that the expected replacement is x[0]. Why is x not replaced during rescanning? C99 and C++0x effectively have the same wording as C++03 in the quoted sections.

    Read the article

  • OpenGL Vertex Attributes - Normalisation

    - by Daniel
    Alas, I have searched, and have found no definitive answer. When would you normalize the vertex data in OpenGL using the following command: glVertexAttribPointer(index, size, type, normalize, stride, pointer); I.e when would normalize == GL_TRUE; what situations, and why would you choose to let the GPU do the calculations instead of preprocessing it? All examples I have ever seen, have this set to GL_FALSE; and I cannot personally see a use for it. But Khronos aren't stupid, so it must be there for something useful (and probably common).

    Read the article

  • Image classification using openCV and weka

    - by simk
    Hi i want to do image classification, so i am planning to use openCV for the preprocessing of image and weka to check which ML algorithm gives best result, so the problem i am facing is converting the image data in to weka ARFF file format, when i apply some image transformation to image and write the image data it become so large and not sure how to define @ATTRIBUTE for that. If you have done similar thing before please suggest how can i solve this and it particularly doesn't have to be openCV i can use other tools also, please suggest.

    Read the article

  • Qt: Is it possible to use mixins technique?

    - by Eye of Hell
    Hello. Qt library includes advanced meta-programming capabilities using they own preprocessing moc compiler. Does anyone knows, is it possible to create some kind of mix-ins via it? For example, i have a QString and want to add a method to it without sub-classing and changing existing code. Does Qt have such solutions for that?

    Read the article

  • Using Regular Expression in VC++

    - by Benit
    Hi , I am finding Email ids in mu project, where I am preprocessing the input using some Regular Expression. RegExpPhone6.RegComp("[\[\{\(][ -]?[s][h][i][f][t][ -]?[+-][2][ -]?[\]\}\)]"); Here while I am compiling i am getting a warning msg like Warning 39 warning C4129: ')' : unrecognized character escape sequence How can i resolve this ? Why this is occuring and Where will it affect? Kindly help me...

    Read the article

  • Drupal Theming and custom variables in custom pages

    - by GaxZE
    hello, I have created a custom page which sits at site.com/user/me/soe now im trying to theme this page and have created a subsequent template file. however if i copy in any basic html into my template file, all it does is produce a white page with my text and abandons the sites structure i originally had. i was hoping somebody could help me understand preprocessing as i feel that is the way to solve this.

    Read the article

  • Looking for early paper about compiling object-oriented code

    - by Robert Kosara
    I remember reading a paper a long time ago that talked about object-oriented programming. I believe that this was from the early 1980s or perhaps even before then. This was at the time when object-oriented programming was still done through pre-processors, and one thing that stuck with me is this: it argued that you could write code in either procedural or object-oriented fashion, and after preprocessing/compiling, you would end up with the exact same machine code. Does anybody know which paper I'm talking about?

    Read the article

  • Use Java and RegEx to convert casing in a string

    - by Andreas
    Problem: Turn "my testtext TARGETSTRING my testtext" into "my testtext targetstring my testtext" Perl supports the "\L"-operation which can be used in the replacement-string. The Pattern-Class does not support this operation: Perl constructs not supported by this class: [...] The preprocessing operations \l \u, \L, and \U. http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html

    Read the article

1 2 3  | Next Page >